fix incorrect Lambda GovCloud regexes #14850
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm putting this up for comment on the approach.
Without this fix:
This occurs because the region name for GovCloud contains an additional section.
Considering the duplication of the regex and the fact that validateLambdaFunctionName is only used in aws_lambda_permission, I'm thinking some cleanup is in order as well, but this patch should work on its own. I'm open to suggestions to improve this, but wasn't sure where I should put the Regex if it needs to be reused. Note that it's tightly coupled to this code as well:
https://github.com/jeremy-asher/terraform/blob/28a2ec1b9fa83549a2b5c45ab75f5928ce848893/builtin/providers/aws/resource_aws_lambda_permission.go#L346-L363