integrations/terraform/README.md
Please, refer to official documentation.
Install protobuf.
Install protoc-gen-terraform @v3.0.3.
go install github.com/gravitational/protoc-gen-terraform/[email protected]
Install Terraform v1.1.0+. Alternatively, you can use tfenv. Please note that on Mac M1 you need to specify TFENV_ARCH (ex: TFENV_ARCH=arm64 tfenv install 1.1.6).
Build and install the plugin:
cd integrations/terraform
make install
Run tests:
make test
Run:
make gen-tfschema
This will generate types_tfschema.go from a current API .proto file, and regenerate the provider code.
If the schema changed, you will need to re-render the docs with:
make docs
Start Teleport.
teleport start
Create Terraform user and role:
tctl create example/terraform.yaml
tctl auth sign --format=file --user=terraform --out=/tmp/terraform-identity --ttl=10h
Create main.tf file:
cp example/main.tf.example example/main.tf
Please note that target identity file was exported to /tmp/terraform-identity on previous step. If you used another location, please change in in main.tf.
Create sample resources:
cp example/user.tf.example example/user.tf
cp example/role.tf.example example/role.tf
cp example/provision_token.tf.example example/provision_token.tf
Please note that some resources require preliminary setup steps.
Apply changes:
make apply
Make changes to .tf files and run:
make reapply
Clean up:
make destroy