Skip to content

resource/aws_security_group_rule: Validate conflicting arguments are not simultaneously specified #18467

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

Merged
merged 1 commit into from
Apr 29, 2021
Merged

resource/aws_security_group_rule: Validate conflicting arguments are not simultaneously specified #18467

merged 1 commit into from
Apr 29, 2021

Conversation

mschuchard
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #15606

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@mschuchard mschuchard requested a review from a team as a code owner March 29, 2021 19:56
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/ec2 Issues and PRs that pertain to the ec2 service. labels Mar 29, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 29, 2021
@github-actions
Copy link

Thank you for your contribution! 🚀

Please note that the CHANGELOG.md file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the Contributing Guide for additional pull request review items.

Remove any changes to the CHANGELOG.md file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.

@mschuchard
Copy link
Contributor Author

Removed CHANGELOG modifications. Created one because of item 2 in Pull Request Lifecycle in the contribution guidelines. Should that entry be removed?

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @mschuchard 👋

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! 😃

@gdavison gdavison self-assigned this Apr 29, 2021
@gdavison gdavison removed the needs-triage Waiting for first response or review from a maintainer. label Apr 29, 2021
@gdavison gdavison merged commit 9a598fa into hashicorp:main Apr 29, 2021
@github-actions github-actions bot added this to the v3.38.0 milestone Apr 29, 2021
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 3.38.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!

@onematchfox
Copy link
Contributor

Hi @mschuchard and @gdavison,

Just a heads up at this point - this change breaks the https://github.com/terraform-aws-modules/terraform-aws-security-group module. Caught me completely off guard 😞 - there's also nothing in the release notes for v3.38.0 about this either?

Error being thrown by the module is:

line 145, in resource "aws_security_group_rule" "computed_ingress_with_source_security_group_id": 
 145:   ipv6_cidr_blocks         = var.ingress_ipv6_cidr_blocks 
"ipv6_cidr_blocks": conflicts with source_security_group_idp

For now, I'm just going to restrict my provider version to < 3.38.0 so I can go back to my weekend. Will try log something more detailed on Monday if someone else doesn't beat me to it.

@mschuchard
Copy link
Contributor Author

mschuchard commented May 2, 2021

@onematchfox The module maintainers would need to update/fix the module to not attempt simultaneously specifying those arguments since they are not allowed by the AWS API. The PR was an improvement/bug fix to invalidate that usage before the API throws an error during create operations during a apply. You can check the linked issue above for more.

@onematchfox
Copy link
Contributor

@onematchfox The module maintainers would need to update/fix the module to not attempt simultaneously specifying those arguments since they are not allowed by the AWS API. The PR was an improvement/bug fix to invalidate that usage before the API throws an error during create operations during a apply. You can check the linked issue above for more.

Fair enough. Except that I could argue that this change is a Breaking Change. Resources that previously planned and applied successfully no longer plan.

I haven't dug too deep but my suspicion is that this is a result of how ConflictsWith works in comparison to the apply of the resource itself. I think the module uses blank lists ([]) as defaults which either weren't actually applied when the resource was applied (or were just ignored by the AWS API). Whereas it would seem like ConflictsWith views the blank list as a value and thus fails validation. Anyway, hopefully it is as simple as adjusting the defaults used on the module.

@mschuchard
Copy link
Contributor Author

For Terraform versions >= 0.12, the null type is used in situations like this for optional arguments. Unless they are still supporting < 0.12, that sounds like the fix here based on your description.

@github-actions
Copy link

github-actions bot commented Jun 2, 2021

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

security_group_rule: 'self' conflicts with 'cidr_blocks'
3 participants