Skip to content
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

Add rds security group description #114

Merged
merged 1 commit into from
Mar 8, 2021

Conversation

nitrocode
Copy link
Member

what

  • Add rds security group description

why

  • tfsec complains
    [AWS018][ERROR] Resource 'module.redis:aws_security_group.default' should include a description for auditing purposes.
    

references

  • N/A

@nitrocode nitrocode requested review from a team as code owners March 8, 2021 15:46
@Gowiem
Copy link
Member

Gowiem commented Mar 8, 2021

/test all

@nitrocode nitrocode merged commit 80943ed into master Mar 8, 2021
@nitrocode nitrocode deleted the rds_security_group_description branch March 8, 2021 19:13
@jurgen-weber-deltatre
Copy link

80943ed#commitcomment-48017475

This breaks the module for anyone who has a currently running cluster.

@nitrocode
Copy link
Member Author

Do you pin your module down?

@jurgen-weber-deltatre
Copy link

jurgen-weber-deltatre commented Mar 9, 2021

I did now to get around the problem, but this is a breaking change.

Should default to the current message and have the ability to overwrite.. not hardcode the new message

@nitrocode
Copy link
Member Author

The security group description is hard coded in a lot of places across most cloudposse modules. This was one of the few places where it wasn't.

I haven't seen this done in any other modules, but would you prefer being able to overwrite the security group description with the default as it is now and you may override it with a null value to retain the previous unsupplied description?

@marcuz
Copy link
Contributor

marcuz commented Mar 9, 2021

The security group description is hard coded in a lot of places across most cloudposse modules. This was one of the few places where it wasn't.

I haven't seen this done in any other modules, but would you prefer being able to overwrite the security group description with the default as it is now and you may override it with a null value to retain the previous unsupplied description?

IMHO yes, this change prevents clean module upgrades, unless you "Delete the network interface, or associate with a different security group" and fiddle with TF state after "migrating" yourself.

@syphernl
Copy link
Contributor

syphernl commented Mar 9, 2021

We ran into the same issue this morning. I have made a fix that allows to configure the description message, so we can re-use the "Managed by Terraform" one for existing clusters.

#115

@nitrocode
Copy link
Member Author

nitrocode commented Mar 9, 2021

After merging @syphernl's PR #115 @marcuz and @jurgen-weber-deltatre these are the options.

  • Pin terraform-aws-elasticache-redis to 0.34.0 to keep the security description empty
  • Pin terraform-aws-elasticache-redis to 0.36.0 and set the security_group_description = null

In either method, please make sure to pin your modules. Using an unpinned module reference is discouraged.

@marcuz
Copy link
Contributor

marcuz commented Mar 9, 2021

Thank you @syphernl and @nitrocode! 👍

@jurgen-weber-deltatre
Copy link

jurgen-weber-deltatre commented Mar 9, 2021

Cool, Thank you.

I know pinning is encouraged but I also disagree with the mentality for many reasons. :) We won't get into that here (Happy to discuss on your slack).

IN the end these are just hacks due to limitations of the AWS API, not anyone's fault here. LOL needing to recreate based on changing the description.

@vsimon
Copy link

vsimon commented Mar 13, 2021

I just hit this problem when going from version 0.34 to 0.37 of this module. I pin all modules versions and review changes. This time I used 'renovate' and in the merge request I saw this new module variable that works around this was mentioned but the "Why" describing there was breaking change was cutoff. The contents of the commit message was good and predicted what ended up happening, I just might hope breaking changes are more prominently displayed or communicated.

For those that hit the problem in 0.37 will see this:

...
module.elasticache_redis.aws_security_group.default[0]: Still destroying... [id=sg-*6013, 9m50s elapsed]
module.elasticache_redis.aws_security_group.default[0]: Still destroying... [id=sg-*6013, 10m0s elapsed]
Error: Error deleting security group: DependencyViolation: resource sg-*6013 has a dependent object
	status code: 400, request id: *

Reverting/Backing out the change will also result in a timeout while still destroying the resource.

To get around the problem, I went to the AWS ElasticCache Console, select the cluster, click Modify, changed "VPC Security Group" to something else like default, click Modify to save changes. Then after doing tf apply again, the module applied cleanly.


Not sure but Issues like #86
or cloudposse/terraform-aws-rds-cluster#86 allude to something that may work to support running cluster cases for these kind of upgrades?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants