Updates the database layer to support is_temporary
Updates the service layer to set is_temporary to true for any non-default workspace
Context for reviewers
Testing instructions, background context, more in-depth details of the implementation, and anything else you'd like to call out or ask reviewers.
When using terraform, you cannot deploy the same resource with the same name. The terraform apply will fail with an error like "A resource with the ID already exists".
We have 2 current strategies to avoid this:
We use a prefix local to prefix the terraform workspace name to resource names.
The combination of these strategies allows us to avoid resource conflicts in our CI pipeline. Our CI jobs use a terraform workspace prefixed with t-. The is_temporary variable currently ensures any service layer resources deployed to a terraform workspace prefixed with t- are marked as temporary.
For platform engineers testing features in the platform-test repository, we try to manually create a new temporary terraform workspace and test out our deployments in that workspace.
This PR
This PR does the following:
Disables DNS creation for any non-default workspace
Make it easier to create and destroy ephemeral resources in both the database layer and the service layer
Renames a destroy script that wasn't included in #635
Testing
Provide evidence that the code works as expected. Explain what was done for testing and the results of the test plan. Include screenshots, GIF demos, shell commands or output to help show the changes working as expected. ProTip: you can drag and drop or paste images into this textbox.
Before this PR, trying to run make infra-update-app-service APP_NAME=app ENVIRONMENT=dev in workspace rlidp on platform-test:
Ticket
Changes
Context for reviewers
When using terraform, you cannot deploy the same resource with the same name. The
terraform apply
will fail with an error like "A resource with the ID already exists".We have 2 current strategies to avoid this:
prefix
local to prefix the terraform workspace name to resource names.is_temporary
to disable creation of some resources (e.g. https://github.com/navapbc/template-infra/blob/2cda6da18c84aa5a3dfb038ab32be4fac363af21/infra/modules/service/dns.tf#L3)The combination of these strategies allows us to avoid resource conflicts in our CI pipeline. Our CI jobs use a terraform workspace prefixed with
t-
. Theis_temporary
variable currently ensures any service layer resources deployed to a terraform workspace prefixed witht-
are marked as temporary.For platform engineers testing features in the
platform-test
repository, we try to manually create a new temporary terraform workspace and test out our deployments in that workspace.This PR
This PR does the following:
Testing
Before this PR, trying to run
make infra-update-app-service APP_NAME=app ENVIRONMENT=dev
in workspacerlidp
onplatform-test
:Successfully tested on https://github.com/navapbc/platform-test/pull/109