Cloudshock / bootstrap

Describes the steps to get the project up and running
MIT License
0 stars 0 forks source link

Incorporate GCP Project ID suffix into Terraform Cloud Organization Name #17

Closed marcboudreau closed 3 years ago

marcboudreau commented 3 years ago

This simple change would allow the initial-setup.sh script to be run without having to destroy the existing Terraform Cloud Organization and GCP Projects.

Currently, because the Terraform Cloud Organization name is simply cloudshock, a second organization with the same name cannot be created, which means that in order to test changes to the script, the Terraform organization needs to be torn down. Once the project has progressed further, this would be too dramatic of a constraint. Instead if the Terraform Cloud Organization incorporates the GCP Project Suffix into its name, testing the initial-setup.sh script would be possible by specifying an alternate suffix so that a parallel Terraform Cloud Organization and parallel GCP Projects are created to validate the script's function and later cleaned up.

marcboudreau commented 3 years ago

Unfortunately, the Terraform Cloud Organization name must be provided as part of the backend configuration in the terraform stanza in the main.tf file. Variable interpolation is not permitted in the backend configuration. Even though Terraform provides a workaround for this constraint, it is not appealing given the current workflow already established.

However, the initial-setup.sh script can be modified to accept a flag indicating that it is being run for testing purposes, which would cause it to use cloudshock-$suffix as the Organization name, rather than simply cloudshock. This approach also provides the ability to skip the terraform import command at the end of the script during testing, since it would corrupt the state of the existing deployment. It also allows having automatic cleanup of the resources created in testing mode.

marcboudreau commented 3 years ago

Resolved by Pull Request #19