diff --git a/database-grants/terraform/README.md b/database-grants/terraform/README.md index e0975e9..6d36d50 100644 --- a/database-grants/terraform/README.md +++ b/database-grants/terraform/README.md @@ -1,6 +1,11 @@ # Prerequisites -- Terraform 1.4.6 , please stick to this version for now, tested 1.6.x, it brings issue with the Dititalocean storage as backend +- Ensure you have `tfenv` installed in your system. https://github.com/tfutils/tfenv + +- The terraform configuration in this directory requires to have `terraform` binary version to be minimum 1.4.6 Ref: https://developer.hashicorp.com/terraform/tutorials/configuration-language/versions#review-example-configuration + + + # How to set up terraform @@ -22,6 +27,21 @@ source setup_keys.sh # How to run terraform +Use correct version: +```bash +tfenv use min-required +``` +OR if you configure `.terraform-version` + +```bash +echo "1.4.6" > .terraform-version +tfenv use # this will configure the correct version from .terraform-version file +``` + +```bash +terraform version # check if the version matches with the required_version in provider.tf +``` + Init: ```bash diff --git a/database-grants/terraform/dev/provider.tf b/database-grants/terraform/dev/provider.tf index 4dacebd..3ddbcc6 100644 --- a/database-grants/terraform/dev/provider.tf +++ b/database-grants/terraform/dev/provider.tf @@ -7,6 +7,9 @@ variable "password" { } terraform { + # Ref: https://developer.hashicorp.com/terraform/tutorials/configuration-language/versions#review-example-configuration + required_version = "~> 1.4.6" + required_providers { postgresql = { source = "cyrilgdn/postgresql" diff --git a/database-grants/terraform/prod/backend.tf b/database-grants/terraform/prod/backend.tf index 2bc7a4d..8f4bf5e 100644 --- a/database-grants/terraform/prod/backend.tf +++ b/database-grants/terraform/prod/backend.tf @@ -11,6 +11,6 @@ terraform { skip_credentials_validation = true # skip_get_ec2_platforms = true skip_requesting_account_id = true - skip_metadata_api_check = true + skip_metadata_api_check = true } }