Tainting aws_apiaws_apigatewayv2_stage.default with a custom domain fails to apply
dekimsey opened this issue · 4 comments
Description
Tainting the aws_apigatewayv2_stage.default
resource with a configured custom domain fails to apply cleanly.
- ✋ I have searched the open/closed issues and my issue is not listed.
⚠️ Note
Before you submit an issue, please perform the following first:
- Remove the local
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
- Re-initialize the project root to pull down modules:
terraform init
- Re-attempt your terraform plan or apply and check if the issue still persists
Versions
-
Module version [Required]:
2.2.0 -
Terraform version:
Terraform v1.3.1
on darwin_arm64
- Provider version(s):
+ provider registry.terraform.io/hashicorp/aws v4.33.0
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/tls v4.0.3
Reproduction Code [Required]
Steps to reproduce the behavior:
Workspace? Yes
Cleared local cache? Yes
Create API Gateway with a custom domain and automatic mapping, make sure the default stage is enabled.
terraform apply
terarform taint aws_apigatewayv2_stage.default
terraform apply
Expected behavior
The default stage is successfully unattached to the custom domain and deleted.
Actual behavior
$ terraform apply
...
module.demo.aws_apigatewayv2_stage.default[0]: Destroying... [id=$default]
│ Error: deleting API Gateway v2 stage ($default): BadRequestException: Deleting stage $default failed. Please remove all base path mappings related to the stage in your domains: demo.example.com
Terminal Output Screenshot(s)
Terraform will perform the following actions:
# module.demo.aws_apigatewayv2_api_mapping.this[0] will be updated in-place
~ resource "aws_apigatewayv2_api_mapping" "this" {
id = "coffee"
~ stage = "$default" -> (known after apply)
# (2 unchanged attributes hidden)
}
# module.demo.aws_apigatewayv2_stage.default[0] is tainted, so must be replaced
-/+ resource "aws_apigatewayv2_stage" "default" {
~ arn = "arn:aws:apigateway:us-east-2::/apis/deadbeef/stages/$default" -> (known after apply)
~ deployment_id = "xfnne7" -> (known after apply)
~ execution_arn = "arn:aws:execute-api:us-east-2:1337133713370:deadbeef/$default" -> (known after apply)
~ id = "$default" -> (known after apply)
~ invoke_url = "https://deadbeef.execute-api.us-east-2.amazonaws.com/" -> (known after apply)
name = "$default"
- stage_variables = {} -> null
...
}
Plan: 1 to add, 1 to change, 1 to destroy.
Do you want to perform these actions in workspace "stg"?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.demo.aws_apigatewayv2_stage.default[0]: Destroying... [id=$default]
╷
│ Error: deleting API Gateway v2 stage ($default): BadRequestException: Deleting stage $default failed. Please remove all base path mappings related to the stage in your domains: demo.example.com
│
│
╵
Additional context
I believe the aws_apigatewayv2_api_mapping.this
resource needs a replace_triggered_by
set for aws_apigatewayv2_stage.default[0]
.
This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
Oh, crud, I missed the bot's ping. To my knowledge, this is still necessary.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.