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
Make use of name_prefix optional #74
Make use of name_prefix optional #74
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.
Good job! Remember to update outputs.tf
also, and add some examples.
main.tf
Outdated
|
||
tags = "${merge(var.tags, map("Name", format("%s", var.name)))}" | ||
|
||
lifecycle { |
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.
create_before_destroy = true
will fail since name
should be unique. This block should be removed from this
security group.
main.tf
Outdated
# Get ID of created Security Group | ||
################################## | ||
locals { | ||
this_sg_id = "${ |
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.
This is correct when SG creation is disabled:
${element(concat(coalescelist(aws_security_group.this.*.id, aws_security_group.this_name_prefix.*.id), list("")), 0)}
Also, write this in one line.
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.
Also, move locals
block at the top on the file.
variables.tf
Outdated
@@ -14,6 +14,11 @@ variable "name" { | |||
description = "Name of security group" | |||
} | |||
|
|||
variable "use_name_prefix" { | |||
default = "false" | |||
description = "Use name_prefix parameter to set the Security Group name instead of the name parameter" |
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.
description = "Whether to use name_prefix or fixed name. Should be true to able to update security group name after initial creation"
default = true
Keep default to true
to allow users to update name and description as they want after the creation. Also, for backward-compatibility reason.
@robinbowes Thanks for this PR! v2.5.0 has been released. |
Thanks for the quick turnaround on this. |
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. |
This change makes the use of the
name_prefix
parameter optional.Fixes #73