diff --git a/README.md b/README.md index 651c153ee..161406485 100644 --- a/README.md +++ b/README.md @@ -141,11 +141,10 @@ Terraform installations. This is great, but you still need to install Terraform itself, which can be done with this command: ```sh -tfenv install latest:^1.4.0 +tfenv install "latest:^1.7" +tfenv use 1.7.x # x = the patch version installed ``` -_NOTE: This project currently uses the latest `1.4.x release of Terraform._ - #### Python Installation Now we're going to install a tool to help us manage Python versions and diff --git a/terraform/README.md b/terraform/README.md index 1d75967f0..4cb2c7cf7 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -89,17 +89,19 @@ These steps assume shared [Terraform state credentials](#terraform-state-credent 1. Run `cf spaces` and, from the output, copy the space name for the environment you are working in, such as `notify-sandbox`. -1. Next you will set up a SpaceDeployer. Prepare to fill in these values: - * `` will be the string you copied from the prior step - * `` can be anything, although we recommend something that communicates the purpose of the deployer. For example: "circleci-deployer" for the credentials CircleCI uses to deploy the application, or "sandbox-" for credentials to run terraform manually. +1. Next you will set up a SpaceDeployer service account instance. This is something like a stub user account, just for deployment. Note these two values which you will use both to create and destroy the account: + 1. `` will be the string you copied from the prior step + 1. `` can be anything, although we recommend something that communicates the purpose of the deployer. For example: "circleci-deployer" for the credentials CircleCI uses to deploy the application, or "sandbox-" for credentials to run terraform manually. - Put those two values into this command: + Put those two values into this command: ```bash - ./create_service_account.sh -s -u > secrets.auto.tfvars + ../create_service_account.sh -s -u > secrets.auto.tfvars ``` The script will output the `username` (as `cf_user`) and `password` (as `cf_password`) for your ``. The [cloud.gov service account documentation](https://cloud.gov/docs/services/cloud-gov-service-account/) has more information. + Some resources you might work on require a SpaceDeployer account with higher permissions. Add the `-m` flag to the command to get this. + The command uses the redirection operator (`>`) to write that output to the `secrets.auto.tfvars` file. Terraform will find the username and password there, and use them as input variables. 1. While still in an environment directory, initialize Terraform: @@ -137,6 +139,8 @@ These steps assume shared [Terraform state credentials](#terraform-state-credent ./destroy_service_account.sh -s -u ``` + List `cf services` if you are unsure which space deployer service instances still exist + Optionally, you can also `rm secrets.auto.tfvars` ## Structure @@ -195,3 +199,18 @@ You need to re-authenticate with the Cloud Foundry CLI cf login -a api.fr.cloud.gov --sso ``` You may also need to log in again to the Cloud.gov website. + +### CF account not authorized + +``` +Error: You are not authorized to perform the requested action +``` +This error indicates that the Cloud Foundry user account (or service account) needs OrgManager permissions to take the action. +* When you create a SpaceDeployer service account, use the `-m` flag when running the `./create_service_account.sh` script +* Your own CF user may may also require OrgManager permissions to run the script + +### Services limit +``` +You have exceeded your organization's services limit. +``` +Too many Cloud Foundry services have been created without being destroyed. Perhaps Terraform developers have forgotten to delete their SpaceDeployers after they finish with them. List `cf services` to see. diff --git a/terraform/bootstrap/main.tf b/terraform/bootstrap/main.tf index 2394f4ab8..14ab9a81d 100644 --- a/terraform/bootstrap/main.tf +++ b/terraform/bootstrap/main.tf @@ -3,7 +3,7 @@ locals { } module "s3" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.9.1" cf_org_name = "gsa-tts-benefits-studio" cf_space_name = "notify-management" diff --git a/terraform/bootstrap/providers.tf b/terraform/bootstrap/providers.tf index 5dcaece3e..7b9ce5c7f 100644 --- a/terraform/bootstrap/providers.tf +++ b/terraform/bootstrap/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } } diff --git a/terraform/demo/providers.tf b/terraform/demo/providers.tf index f13333d3e..f8d1f3727 100644 --- a/terraform/demo/providers.tf +++ b/terraform/demo/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } diff --git a/terraform/development/providers.tf b/terraform/development/providers.tf index 5dcaece3e..7b9ce5c7f 100644 --- a/terraform/development/providers.tf +++ b/terraform/development/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } } diff --git a/terraform/production/providers.tf b/terraform/production/providers.tf index 499759f48..f014e1989 100644 --- a/terraform/production/providers.tf +++ b/terraform/production/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } diff --git a/terraform/sandbox/main.tf b/terraform/sandbox/main.tf index fae30073c..f194efdd4 100644 --- a/terraform/sandbox/main.tf +++ b/terraform/sandbox/main.tf @@ -17,7 +17,7 @@ module "database" { } module "redis" { - source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1" + source = "github.com/18f/terraform-cloudgov//redis?ref=v0.9.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name @@ -27,7 +27,7 @@ module "redis" { } module "csv_upload_bucket" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.9.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name diff --git a/terraform/sandbox/providers.tf b/terraform/sandbox/providers.tf index d5a3313de..6d2800363 100644 --- a/terraform/sandbox/providers.tf +++ b/terraform/sandbox/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } diff --git a/terraform/shared/egress_space/providers.tf b/terraform/shared/egress_space/providers.tf index 21ac567a2..dec8379ee 100644 --- a/terraform/shared/egress_space/providers.tf +++ b/terraform/shared/egress_space/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } } diff --git a/terraform/shared/ses/providers.tf b/terraform/shared/ses/providers.tf index 21ac567a2..dec8379ee 100644 --- a/terraform/shared/ses/providers.tf +++ b/terraform/shared/ses/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } } diff --git a/terraform/shared/sns/providers.tf b/terraform/shared/sns/providers.tf index 21ac567a2..dec8379ee 100644 --- a/terraform/shared/sns/providers.tf +++ b/terraform/shared/sns/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } } } diff --git a/terraform/staging/providers.tf b/terraform/staging/providers.tf index 11dceea7d..d60f220c6 100644 --- a/terraform/staging/providers.tf +++ b/terraform/staging/providers.tf @@ -1,9 +1,9 @@ terraform { - required_version = "~> 1.0" + required_version = "~> 1.7" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.53.0" + version = "0.53.1" } }