-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
aws_api_gateway_method_settings
disable throttling when removing optional attributes
#5690
Comments
Hi @jayanderson 👋 Thank you for reporting this and sorry this is giving you trouble. I'm able to confirm the behaviors you describe using a Terraform configuration very similar to yours: terraform {
required_providers {
aws = "2.34.0"
}
required_version = "0.12.13"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_api_gateway_rest_api" "rest_api" {
name = "rest-api"
}
resource "aws_api_gateway_method" "rest_api-any-method" {
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
resource_id = "${aws_api_gateway_resource.rest_api-resource.id}"
http_method = "ANY"
authorization = "NONE"
}
resource "aws_api_gateway_integration" "rest_api-post-integration" {
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
resource_id = "${aws_api_gateway_resource.rest_api-resource.id}"
http_method = "${aws_api_gateway_method.rest_api-any-method.http_method}"
type = "HTTP_PROXY"
integration_http_method = "${aws_api_gateway_method.rest_api-any-method.http_method}"
passthrough_behavior = "WHEN_NO_MATCH"
uri = "https://httpbin.org/get"
}
resource "aws_api_gateway_resource" "rest_api-resource" {
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
parent_id = "${aws_api_gateway_rest_api.rest_api.root_resource_id}"
path_part = "gateway"
}
resource "aws_api_gateway_method_settings" "settings" {
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
stage_name = "${aws_api_gateway_stage.stage.stage_name}"
method_path = "*/*"
settings {
# Set throttling values
throttling_burst_limit = 1000
throttling_rate_limit = 5000
metrics_enabled = true
# Actually disable throttling
# throttling_burst_limit = -1
# throttling_rate_limit = -1
}
}
resource "aws_api_gateway_stage" "stage" {
stage_name = "dev"
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
deployment_id = "${aws_api_gateway_deployment.rest_api-deploy.id}"
cache_cluster_size = "0.5"
}
resource "aws_api_gateway_deployment" "rest_api-deploy" {
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
stage_name = ""
depends_on = ["aws_api_gateway_integration.rest_api-post-integration"]
} Notes:
The last few notes in particular leave us in a bit of a bind right now. If we fix the drift detection, Terraform will start reporting a bunch of differences in live configurations unless we get the defaults correct for all the settings. Those defaults may be influenced by other API Gateway functionality or settings, such as the account level limits. Without even worrying about the drift detection problem, the Terraform Plugin SDK limitation would prevent us from fixing this today without changing the defaults for these two arguments to I have a feeling that introducing a "breaking" change of defaulting to |
The breaking-change made to enable a user to configure throttling settings between enabling/disabling values has been merged and will release with the upcoming |
This has been released in version 3.0.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Affected Resource(s)
aws_api_gateway_method_settings
Terraform Configuration Files
Below is a full deployable example. The main part we care about are the throttling attributes in the
aws_api_gateway_method_settings
resource.Debug Output
When removing the
throttling_burst_limit
orthrottling_rate_limit
fields it sets them to zero instead of-1
to disable them.Panic Output
N/A
Expected Behavior
When the fields are remove it should set them to
-1
instead to correctly disable them.Actual Behavior
When the fields are removed it sets the values to
0
.Steps to Reproduce
terraform apply
(I don't have the above example perfectly setup and it has an error the first time. May need to be applied twice to correctly create all resources).aws apigateway get-stage --rest-api-id <id> --stage-name dev
Get the current settingsterraform apply
aws apigateway get-stage --rest-api-id <id> --stage-name dev
Get the current settingsImportant Factoids
The☹️ . I don't know what the interaction between the two fields if only one is correctly disabled. I assume they should always be disabled together.
-1
isn't documented by amazonReferences
The text was updated successfully, but these errors were encountered: