From 3b45c5f33c9f2af56a5008062183005b91f4d985 Mon Sep 17 00:00:00 2001 From: dadiorchen Date: Mon, 30 Oct 2023 23:01:49 +0000 Subject: [PATCH] fix: bug of terraform with s3/do space, now can run terraform plan & apply successfully --- database-grants/terraform/README.md | 38 +++++++++++++++++++++ database-grants/terraform/dev/setup_keys.sh | 0 database-grants/terraform/prod/backend.tf | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 database-grants/terraform/README.md mode change 100644 => 100755 database-grants/terraform/dev/setup_keys.sh diff --git a/database-grants/terraform/README.md b/database-grants/terraform/README.md new file mode 100644 index 0000000..313ab3f --- /dev/null +++ b/database-grants/terraform/README.md @@ -0,0 +1,38 @@ +# How to set up terraform + +Find your digitalocean spaces access key and secret key here: https://cloud.digitalocean.com/account/api/spaces?i=d79377 + +Save it to your local `~/.netrc` file: + +```bash +echo "machine sfo2.digitaloceanspaces.com login $SPACES_KEY password $SPACES_SECRET" >> ~/.netrc +``` + +Go the env folder, load key + +```bash +cd dev +source setup_keys.sh +``` + +# How to run terraform + +Init: + +```bash +terraform init -backend-config=backend-config.tfvars +``` + +Plan, in the prompt input the database password: + +```bash +terraform plan -var-file=dev.env.tfvars +``` + +Apply: + +```bash +terraform apply -var-file=dev.env.tfvars +``` + + diff --git a/database-grants/terraform/dev/setup_keys.sh b/database-grants/terraform/dev/setup_keys.sh old mode 100644 new mode 100755 diff --git a/database-grants/terraform/prod/backend.tf b/database-grants/terraform/prod/backend.tf index c857125..2bc7a4d 100644 --- a/database-grants/terraform/prod/backend.tf +++ b/database-grants/terraform/prod/backend.tf @@ -10,7 +10,7 @@ terraform { # Deactivate a few checks as TF will attempt these against AWS skip_credentials_validation = true # skip_get_ec2_platforms = true - # skip_requesting_account_id = true + skip_requesting_account_id = true skip_metadata_api_check = true } }