-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
resource/aws_api_gateway_usag_plan: Fixed setting of rate_limit #2076
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind adding an acceptance test (or modifying an existing one) with this field confirming the bug is fixed and remains that way? 🙂
@@ -355,7 +355,7 @@ func resourceAwsApiGatewayUsagePlanUpdate(d *schema.ResourceData, meta interface | |||
operations = append(operations, &apigateway.PatchOperation{ | |||
Op: aws.String("replace"), | |||
Path: aws.String("/throttle/rateLimit"), | |||
Value: aws.String(strconv.Itoa(d["rate_limit"].(int))), | |||
Value: aws.String(strconv.FormatFloat(d["rate_limit"].(float64), 'E', -1, 64)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a nitpick, but is there any value in exposing the exponent? i.e. in using E
? Is the API actually going to parse it correctly and do something with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably no value, preferred the use of the f
format instead
@@ -369,7 +369,7 @@ func resourceAwsApiGatewayUsagePlanUpdate(d *schema.ResourceData, meta interface | |||
operations = append(operations, &apigateway.PatchOperation{ | |||
Op: aws.String("add"), | |||
Path: aws.String("/throttle/rateLimit"), | |||
Value: aws.String(strconv.Itoa(d["rate_limit"].(int))), | |||
Value: aws.String(strconv.FormatFloat(d["rate_limit"].(float64), 'E', -1, 64)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here ^
42f8e79
to
dca0899
Compare
Here we go!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM.
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! |
Fixes #2057
This fixes the fact to correctly send the value on creation, due to the casting made: as the schema type is of type int and we try to check if the value cast as a float64 is ok, the check was always ignored on creation.