-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error redeploying API gateway stage when mapped to custom domain path #10674
Comments
@mitchellh: I've got the same problem. If I don't add a variable to to the API Gateway deployment, I can't then get a republish of the API to the target stage every time. I've basically added a script that does a manual terraform destroy of the resource beforehand - but it's very frustrating from a tooling perspective to figure out why the destroy isn't happening organically. |
Hi @mitchellh, @steve-gray, we came across this too. We have a When we try to deploy, we got the same error as OP. Our workaround currently is to execute a Hope our workaround helps others too. |
This is also an issue for Terraform 0.9.2. Could it be related to the fact that there is no aws_api_gateway_stage ? |
I found that using lifecycle "create_before_destroy" on the aws_api_gateway_deployment solves the problem; e.g.
|
@4dz I tried this fix and it didn't work if I was also using aws_api_gateway_base_path_mapping with a wide open base path. It would be great for Terraform to understand that it needs to destroy the mapping first. |
I ended up solving it by adding a unique variable to the deployment reflecting all of my API Gateway resources. Since change in locals {
lambda_integrations = [
"${module.foo_resource.resource_id}",
"${module.bar_resource.resource_id}",
"${module.baz_resource.resource_id}",
]
}
resource "aws_api_gateway_deployment" "example" {
# ...
variables = {
integrations = "${join(",", local.lambda_integrations)}"
}
# ...
} |
@kylelaverty did you solve the issue? I have the same problem that you. |
@safv12 I am no longer on the team that was encountering the issue. But before I left we didn't solve it and instead had to manually deploy that part. |
@kylelaverty @safv12 I had the same issue with a wide open base path mapping. It finally worked by explicitly specifying an |
In the Terraform aws_api_gateway_deployment resource, use the `lifecycle.create_before_destroy: True` option as described in hashicorp/terraform#10674. Fixes aws#1237
In the Terraform aws_api_gateway_deployment resource, use the `lifecycle.create_before_destroy: True` option as described in hashicorp/terraform#10674. Fixes #1237
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. |
When redeploying an aws_api_gateway_deployment to the same stage and that stage is mapped to an aws_api_gateway_base_path_mapping, the deployment fails with error:
aws_api_gateway_deployment.deployment: BadRequestException: Active stages pointing to this deployment must be moved or deleted
Terraform Version
7.11
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
API redeployed to the stage and the base path mapping still pointed to that stage.
Actual Behavior
API deployment failed with error:
Steps to Reproduce
terraform apply
note: first run of terraform apply may pass. It's when redeploying that the issue occurs.
Important Factoids
I am forcing a new API deployment on every run of apply by using the
uuid()
method in an API deployment variable.The text was updated successfully, but these errors were encountered: