-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
api_gateway_rest_api
: Adds parameter fail_on_warnings [rebased]
#22300
api_gateway_rest_api
: Adds parameter fail_on_warnings [rebased]
#22300
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.
Welcome @fullammo 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
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.
LGTM 🚀
After closer review, changes will be needed.
Awesome! Could this change be included in one of the upcoming releases? Thanks in advance! |
There were merge conflicts, i resolved them by rebasing the codebase to the latest main, just to make the merge a bit smoother 🥇 |
Any updates on this? We can use this as well, and it would help a bunch? |
This would be a good feature to implement to prevent any deployment issues. Please merge this in |
It would be an improvement to the current behavior that 'swallows' warnings. Our team could benefit from it. |
Hey team, any update on this? Our team can utilise this as well... |
Hello! This feature would help our team as well! |
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.
AWS's API requires first creating a REST API and then updating that API if an OpenAPI spec is supplied.
Terraform's implementation of this resource is aligned to that intended use, where Terraform first creates a REST API (without an OpenAPI definition) and then if a OpenAPI definition is supplied immediately updates the API using the OpenAPI definition.
A failOnWarning during create
would most likely result in an empty REST API, as the rollback would rollback the OpenAPI application step.
A failOnWarning during update
would result in the expected behavior, but would leave the Terraform state in an inconsistent state. My hypothesis is the author saw this inconsistent state when testing, and this is why they removed the computed field from create_date
.
Implementation of this failOnWarning
feature introduces to many permutations of the potential resource and state due to the AWS APIs requirements, and this would require significant more AccTests to provide surety on permutation coverage.
@@ -55,7 +55,10 @@ func ResourceRestAPI() *schema.Resource { | |||
}, | |||
"created_date": { | |||
Type: schema.TypeString, | |||
Computed: true, | |||
|
|||
"fail_on_warnings": { |
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.
It's important to note that the failOnWarnings parameter only applies to AWS's PutRestApi() method when using an OpenAPI definition. This is an update of an existing API only.
AWS's API requires first creating a REST API and then updating that API if an OpenAPI spec is supplied.
Terraform's implementation of this resource is aligned to that intended use, where Terraform first creates a REST API (without an OpenAPI definition) and then if a OpenAPI definition is supplied immediately updates the API using the OpenAPI definition.
@@ -229,6 +229,7 @@ The following arguments are supported: | |||
* `endpoint_configuration` - (Optional) Configuration block defining API endpoint configuration including endpoint type. Defined below. | |||
* `minimum_compression_size` - (Optional) Minimum response size to compress for the REST API. Integer between `-1` and `10485760` (10MB). Setting a value greater than `-1` will enable compression, `-1` disables compression (default). If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value (_except_ `-1`) is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value. | |||
* `name` - (Required) Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value. | |||
* `fail_on_warnings` - (Optional) Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false` |
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.
In our documentation, arguments are listed in alphabetical order. This argument should come after endpoint_configuration
and before minimum_compression_size
.
Co-authored-by: Tyler Lynch <[email protected]>
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Closes #19154.
Closes #22674.
Closes #18397.
This PR is an up to date version of PR#18397, which complies to the mentioned refactoring changes that had to be addressed.
Output from acceptance testing:
@johanwiren This was the easiest way to resolve your merge conflicts, I hope it's not a problem. 😄