-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Security Groups with name or name_prefix starting with "terraform-" get recreated every time #17017
Comments
Thank you for reporting this issue, @crubier, as this is certainly unexpected behavior. Please note that the
The fix in this case should be fairly straightforward and I will try to get that submitted along with covering testing (and contributing guide documentation) later today. |
Reference: #17017 Changes: ``` * resource/aws_cloudwatch_event_rule: Prevent perpetual differences with `name_prefix` argument values beginning with `terraform-` * resource/aws_security_group: Prevent perpetual differences with `name_prefix` argument values beginning with `terraform-` ``` Output from acceptance testing: ``` --- PASS: TestAccAWSCloudWatchEventRule_basic (70.77s) --- PASS: TestAccAWSCloudWatchEventRule_description (52.06s) --- PASS: TestAccAWSCloudWatchEventRule_EventBusName (75.08s) --- PASS: TestAccAWSCloudWatchEventRule_IsEnabled (68.71s) --- PASS: TestAccAWSCloudWatchEventRule_Name_Generated (33.92s) --- PASS: TestAccAWSCloudWatchEventRule_NamePrefix (33.93s) --- PASS: TestAccAWSCloudWatchEventRule_pattern (50.64s) --- PASS: TestAccAWSCloudWatchEventRule_role (48.35s) --- PASS: TestAccAWSCloudWatchEventRule_ScheduleAndPattern (33.93s) --- PASS: TestAccAWSCloudWatchEventRule_tags (83.41s) --- PASS: TestAccAWSSecurityGroup_allowAll (39.02s) --- PASS: TestAccAWSSecurityGroup_basic (38.37s) --- PASS: TestAccAWSSecurityGroup_change (82.06s) --- PASS: TestAccAWSSecurityGroup_CIDRandGroups (55.51s) --- PASS: TestAccAWSSecurityGroup_defaultEgressClassic (13.81s) --- PASS: TestAccAWSSecurityGroup_defaultEgressVPC (49.44s) --- PASS: TestAccAWSSecurityGroup_drift (19.07s) --- PASS: TestAccAWSSecurityGroup_driftComplex (49.44s) --- PASS: TestAccAWSSecurityGroup_egressConfigMode (74.91s) --- PASS: TestAccAWSSecurityGroup_egressWithPrefixList (53.22s) --- PASS: TestAccAWSSecurityGroup_failWithDiffMismatch (39.04s) --- PASS: TestAccAWSSecurityGroup_forceRevokeRulesFalse (682.76s) --- PASS: TestAccAWSSecurityGroup_forceRevokeRulesTrue (737.58s) --- PASS: TestAccAWSSecurityGroup_ingressConfigMode (73.28s) --- PASS: TestAccAWSSecurityGroup_ingressWithCidrAndSGsClassic (14.36s) --- PASS: TestAccAWSSecurityGroup_ingressWithCidrAndSGsVPC (39.61s) --- PASS: TestAccAWSSecurityGroup_ingressWithPrefixList (56.36s) --- PASS: TestAccAWSSecurityGroup_invalidCIDRBlock (6.52s) --- PASS: TestAccAWSSecurityGroup_IPRangeAndSecurityGroupWithSameRules (48.10s) --- PASS: TestAccAWSSecurityGroup_IPRangesWithSameRules (35.83s) --- PASS: TestAccAWSSecurityGroup_ipv4andipv6Egress (35.09s) --- PASS: TestAccAWSSecurityGroup_ipv6 (46.26s) --- PASS: TestAccAWSSecurityGroup_multiIngress (45.44s) --- PASS: TestAccAWSSecurityGroup_Name_Generated (32.72s) --- PASS: TestAccAWSSecurityGroup_Name_TerraformPrefix (32.03s) --- PASS: TestAccAWSSecurityGroup_NamePrefix (34.45s) --- PASS: TestAccAWSSecurityGroup_NamePrefix_TerraformPrefix (32.44s) --- PASS: TestAccAWSSecurityGroup_ruleDescription (112.40s) --- PASS: TestAccAWSSecurityGroup_ruleGathering (57.85s) --- PASS: TestAccAWSSecurityGroup_ruleLimitCidrBlockExceededAppend (71.38s) --- PASS: TestAccAWSSecurityGroup_ruleLimitExceededAllNew (88.92s) --- PASS: TestAccAWSSecurityGroup_ruleLimitExceededAppend (81.66s) --- PASS: TestAccAWSSecurityGroup_ruleLimitExceededPrepend (72.60s) --- PASS: TestAccAWSSecurityGroup_rulesDropOnError (72.96s) --- PASS: TestAccAWSSecurityGroup_self (39.48s) --- PASS: TestAccAWSSecurityGroup_sourceSecurityGroup (31.15s) --- PASS: TestAccAWSSecurityGroup_tags (76.38s) --- PASS: TestAccAWSSecurityGroup_vpc (39.96s) --- PASS: TestAccAWSSecurityGroup_vpcNegOneIngress (45.88s) --- PASS: TestAccAWSSecurityGroup_vpcProtoNumIngress (37.04s) ```
Pull request submitted here: #17030 |
…7030) Reference: #17017 Changes: ``` * resource/aws_cloudwatch_event_rule: Prevent perpetual differences with `name_prefix` argument values beginning with `terraform-` * resource/aws_security_group: Prevent perpetual differences with `name_prefix` argument values beginning with `terraform-` ``` Output from acceptance testing: ``` --- PASS: TestAccAWSCloudWatchEventRule_basic (70.77s) --- PASS: TestAccAWSCloudWatchEventRule_description (52.06s) --- PASS: TestAccAWSCloudWatchEventRule_EventBusName (75.08s) --- PASS: TestAccAWSCloudWatchEventRule_IsEnabled (68.71s) --- PASS: TestAccAWSCloudWatchEventRule_Name_Generated (33.92s) --- PASS: TestAccAWSCloudWatchEventRule_NamePrefix (33.93s) --- PASS: TestAccAWSCloudWatchEventRule_pattern (50.64s) --- PASS: TestAccAWSCloudWatchEventRule_role (48.35s) --- PASS: TestAccAWSCloudWatchEventRule_ScheduleAndPattern (33.93s) --- PASS: TestAccAWSCloudWatchEventRule_tags (83.41s) --- PASS: TestAccAWSSecurityGroup_allowAll (39.02s) --- PASS: TestAccAWSSecurityGroup_basic (38.37s) --- PASS: TestAccAWSSecurityGroup_change (82.06s) --- PASS: TestAccAWSSecurityGroup_CIDRandGroups (55.51s) --- PASS: TestAccAWSSecurityGroup_defaultEgressClassic (13.81s) --- PASS: TestAccAWSSecurityGroup_defaultEgressVPC (49.44s) --- PASS: TestAccAWSSecurityGroup_drift (19.07s) --- PASS: TestAccAWSSecurityGroup_driftComplex (49.44s) --- PASS: TestAccAWSSecurityGroup_egressConfigMode (74.91s) --- PASS: TestAccAWSSecurityGroup_egressWithPrefixList (53.22s) --- PASS: TestAccAWSSecurityGroup_failWithDiffMismatch (39.04s) --- PASS: TestAccAWSSecurityGroup_forceRevokeRulesFalse (682.76s) --- PASS: TestAccAWSSecurityGroup_forceRevokeRulesTrue (737.58s) --- PASS: TestAccAWSSecurityGroup_ingressConfigMode (73.28s) --- PASS: TestAccAWSSecurityGroup_ingressWithCidrAndSGsClassic (14.36s) --- PASS: TestAccAWSSecurityGroup_ingressWithCidrAndSGsVPC (39.61s) --- PASS: TestAccAWSSecurityGroup_ingressWithPrefixList (56.36s) --- PASS: TestAccAWSSecurityGroup_invalidCIDRBlock (6.52s) --- PASS: TestAccAWSSecurityGroup_IPRangeAndSecurityGroupWithSameRules (48.10s) --- PASS: TestAccAWSSecurityGroup_IPRangesWithSameRules (35.83s) --- PASS: TestAccAWSSecurityGroup_ipv4andipv6Egress (35.09s) --- PASS: TestAccAWSSecurityGroup_ipv6 (46.26s) --- PASS: TestAccAWSSecurityGroup_multiIngress (45.44s) --- PASS: TestAccAWSSecurityGroup_Name_Generated (32.72s) --- PASS: TestAccAWSSecurityGroup_Name_TerraformPrefix (32.03s) --- PASS: TestAccAWSSecurityGroup_NamePrefix (34.45s) --- PASS: TestAccAWSSecurityGroup_NamePrefix_TerraformPrefix (32.44s) --- PASS: TestAccAWSSecurityGroup_ruleDescription (112.40s) --- PASS: TestAccAWSSecurityGroup_ruleGathering (57.85s) --- PASS: TestAccAWSSecurityGroup_ruleLimitCidrBlockExceededAppend (71.38s) --- PASS: TestAccAWSSecurityGroup_ruleLimitExceededAllNew (88.92s) --- PASS: TestAccAWSSecurityGroup_ruleLimitExceededAppend (81.66s) --- PASS: TestAccAWSSecurityGroup_ruleLimitExceededPrepend (72.60s) --- PASS: TestAccAWSSecurityGroup_rulesDropOnError (72.96s) --- PASS: TestAccAWSSecurityGroup_self (39.48s) --- PASS: TestAccAWSSecurityGroup_sourceSecurityGroup (31.15s) --- PASS: TestAccAWSSecurityGroup_tags (76.38s) --- PASS: TestAccAWSSecurityGroup_vpc (39.96s) --- PASS: TestAccAWSSecurityGroup_vpcNegOneIngress (45.88s) --- PASS: TestAccAWSSecurityGroup_vpcProtoNumIngress (37.04s) ```
This has been released in version 3.27.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 CLI and Terraform AWS Provider Version
terraform v1.12
and upterraform-provider-aws v2.50
and upAffected Resource(s)
name
/name_prefix
API patternTerraform Configuration Files
Minimum reproduction:
This is used for example in
terraform-aws-eks
in two places:Debug Output
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
References
This is very related to this comment. Same cause, different effect SecurityGroup: Unintentional destroy/creation of same resource with long names #14898 (comment)
This is caused by this line of the current project
terraform-provider-aws/aws/internal/naming/naming.go
Line 58 in e208508
The prefix is defined there https://github.com/hashicorp/terraform-plugin-sdk/blob/651b26a663d34daed50d135ddd25e170ff6c6aae/helper/resource/id.go#L10
Big boss told me to open this issue :-) https://twitter.com/mitchellh/status/1347375993057464322?s=20
The text was updated successfully, but these errors were encountered: