cds-snc / url-shortener

An API written in Python that shortens URLs
MIT License
4 stars 1 forks source link

fix: green/blue versions #347

Closed maxneuvians closed 1 year ago

maxneuvians commented 1 year ago

Part of #274. This PR adds the alias latest to the terraform code while ignoring any changes to the function version and routing configuration which will be handled by the green/blue deploy action. It also re-routes the function url to the latest alias.

github-actions[bot] commented 1 year ago

Staging: api

✅   Terraform Init: success ✅   Terraform Validate: success ✅   Terraform Format: success ✅   Terraform Plan: success ✅   Conftest: success

⚠️   Warning: resources will be destroyed by this change!

Plan: 2 to add, 0 to change, 1 to destroy
Show summary | CHANGE | NAME | |----------|-----------------------------------------------| | add | `aws_lambda_alias.url_shortener_lambda_alias` | | recreate | `aws_lambda_function_url.url_shortener_url` |
Show plan ```terraform Resource actions are indicated with the following symbols: + create -/+ destroy and then create replacement Terraform will perform the following actions: # aws_lambda_alias.url_shortener_lambda_alias will be created + resource "aws_lambda_alias" "url_shortener_lambda_alias" { + arn = (known after apply) + description = "The latest version of the lambda function" + function_name = "url-shortener-api" + function_version = "1" + id = (known after apply) + invoke_arn = (known after apply) + name = "latest" } # aws_lambda_function_url.url_shortener_url must be replaced -/+ resource "aws_lambda_function_url" "url_shortener_url" { ~ function_arn = "arn:aws:lambda:ca-central-1:843973686572:function:url-shortener-api" -> (known after apply) ~ function_url = "https://ikuhdso72yomvbpvnwxy4odtna0fxnec.lambda-url.ca-central-1.on.aws/" -> (known after apply) ~ id = "url-shortener-api" -> (known after apply) + qualifier = "latest" # forces replacement ~ url_id = "ikuhdso72yomvbpvnwxy4odtna0fxnec" -> (known after apply) # (2 unchanged attributes hidden) } Plan: 2 to add, 0 to change, 1 to destroy. Changes to Outputs: ~ function_url = "https://ikuhdso72yomvbpvnwxy4odtna0fxnec.lambda-url.ca-central-1.on.aws/" -> (known after apply) ───────────────────────────────────────────────────────────────────────────── Saved the plan to: plan.tfplan To perform exactly these actions, run the following command to apply: terraform apply "plan.tfplan" ```
Show Conftest results ```sh WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_cloudwatch_log_group.sentinel_forwarder_lambda"] WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda"] WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_role.sentinel_forwarder_lambda"] WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder"] 21 tests, 17 passed, 4 warnings, 0 failures, 0 exceptions ```