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

Make use of name_prefix optional #74

Merged

Conversation

robinbowes
Copy link
Contributor

This change makes the use of the name_prefix parameter optional.

Fixes #73

Copy link
Member

@antonbabenko antonbabenko left a 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 {
Copy link
Member

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 = "${
Copy link
Member

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.

Copy link
Member

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"
Copy link
Member

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.

main.tf Show resolved Hide resolved
@antonbabenko antonbabenko merged commit 9efeb02 into terraform-aws-modules:master Sep 12, 2018
antonbabenko added a commit that referenced this pull request Sep 12, 2018
@antonbabenko
Copy link
Member

@robinbowes Thanks for this PR!

v2.5.0 has been released.

@robinbowes
Copy link
Contributor Author

Thanks for the quick turnaround on this.

@github-actions
Copy link

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 Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create a security group with a specific name
2 participants