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

Added allowed_cidr_blocks variable to allow traffic from CIDR blocks #10

Merged
merged 1 commit into from
May 30, 2017

Conversation

iuriaranda
Copy link
Contributor

No description provided.

Copy link
Member

@simonrondelez simonrondelez left a comment

Choose a reason for hiding this comment

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

not sure if this should be part of the RDS module

Copy link
Member

@duboisph duboisph left a comment

Choose a reason for hiding this comment

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

PR in itself is ok. But maybe like Simon says this shouldn't be part of the RDS module at all and we should just output the SG ID so we can attach rules to it via our "standard" way of centralising them in the securitygroups module.

Of course that would be a breaking change for other projects, so if we go that way we need to be sure it's versioned.

If I'm not mistaken that's the same behavior as with the Bastion module.

@iuriaranda
Copy link
Contributor Author

Well I sort of agree, but in any case that wasn't possible before this PR, because the ingress rule for var.security_groups was embedded inside the security group definition. After this PR is merged you can do it both ways, because both var.security_groups and var.allowed_cidr_blocks are optional. So for complex setups you can attach rules outside this module like you said, but for simpler setups you can simply pass the cidr blocks or the security groups you want to give access into the module as variables.

@duboisph
Copy link
Member

Ah, true, you don't have to provide them. I propose you add the output for the SG then and document the possibility for such a setup.

tags {
Name = "${var.project}-${var.environment}${var.tag}-sg_rds"
Environment = "${var.environment}"
Project = "${var.project}"
}
}

resource "aws_security_group_rule" "rds_sg_in" {
count = "${length(var.security_groups)}"
Copy link
Member

Choose a reason for hiding this comment

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

Actually, I overlooked this in my first review. Are you sure this works, did you test it? Tried to do the same a couple of TF versions ago and it was not possible in a count. That means you have to add an extra parameter to set the count fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ok, cool, than my positive review is still valid ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Simple cases work, but not yet everything. Here is some more info what is supported and what not:

hashicorp/terraform#11482 (comment)

@iuriaranda iuriaranda merged commit f6b48a1 into master May 30, 2017
@iuriaranda iuriaranda deleted the allow-cidr branch May 30, 2017 06:26
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.

4 participants