Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Bugfix/self not in security group #94

Merged
merged 11 commits into from
Sep 20, 2018

Conversation

jcejohnson
Copy link
Contributor

When the security group for the vault cluster's nodes is created, it does not include itself in the allowed inbound security group ids.

@@ -132,8 +132,8 @@ module "security_group_rules" {

security_group_id = "${aws_security_group.lc_security_group.id}"
allowed_inbound_cidr_blocks = ["${var.allowed_inbound_cidr_blocks}"]
allowed_inbound_security_group_ids = ["${var.allowed_inbound_security_group_ids}"]
allowed_inbound_security_group_count = "${var.allowed_inbound_security_group_count}"
allowed_inbound_security_group_ids = "${concat(list(aws_security_group.lc_security_group.id), var.allowed_inbound_security_group_ids)}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the proper way to do this is to add an explicit rule with self in the security group rules module.

Also, I could've sworn we did that already...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found my source of confusion: The rule that's there now is for the cluster port (8201). My usecase is expecting the API port (8200) also. I've updated this PR to use the 'self' approach for both. If exposing the API port between nodes doesn't fit your intent (e.g. - minimal permission) then I'll cancel this PR & implement it on my side.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ohhhh... Hm, I think exposing that port between nodes is the right thing to do, thx!

Copy link
Collaborator

@brikis98 brikis98 left a comment

Choose a reason for hiding this comment

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

This looks great. Just one last formatting question and this is good to merge. Thank you!

@@ -132,7 +132,7 @@ module "security_group_rules" {

security_group_id = "${aws_security_group.lc_security_group.id}"
allowed_inbound_cidr_blocks = ["${var.allowed_inbound_cidr_blocks}"]
allowed_inbound_security_group_ids = ["${var.allowed_inbound_security_group_ids}"]
allowed_inbound_security_group_ids = "${var.allowed_inbound_security_group_ids}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove the brackets here? I think this may lead to an error when multiple IDs are passed...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hrm. To be honest, I've gone back and forth on similar bits in my own code. In variables.tf, allowed_inbound_security_group_ids is defined to be a list. When I removed the brackets my assumption was that, due to that definition, it should "just work". You've got me second-guessing myself but it does work in my usecase. I'll put the brackets back since it was clearly working & passing tests.

@brikis98
Copy link
Collaborator

Great, thanks! Merging now and will let tests run. When they pass, I'll issue a new release and paste the link here.

@brikis98 brikis98 merged commit 83e4c9f into hashicorp:master Sep 20, 2018
@brikis98
Copy link
Collaborator

@jcejohnson jcejohnson deleted the bugfix/self-not-in-security-group branch September 20, 2018 14:26
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.

3 participants