Skip to content

Commit

Permalink
Make allowed CIDR blocks a variable (#12)
Browse files Browse the repository at this point in the history
* make allowed cidr blocks a variable

* fix formatting
  • Loading branch information
oavdeev-hs authored and aknysh committed Oct 17, 2018
1 parent 539ca68 commit 309ab85
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Available targets:
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | string | `bastion` | no |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `global` | no |
| security_groups | AWS security group ids | list | - | yes |
| allowed_cidr_blocks | A list of CIDR blocks allowed to connect | list | ["0.0.0.0/0"] | no |
| ssh_user | Default SSH user for this AMI. e.g. `ec2user` for Amazon Linux and `ubuntu` for Ubuntu systems | string | - | yes |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `default` | no |
| subnets | AWS subnet ids | list | `<list>` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | string | `bastion` | no |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `global` | no |
| security_groups | AWS security group ids | list | - | yes |
| allowed_cidr_blocks | A list of CIDR blocks allowed to connect | list | ["0.0.0.0/0"] | no |
| ssh_user | Default SSH user for this AMI. e.g. `ec2user` for Amazon Linux and `ubuntu` for Ubuntu systems | string | - | yes |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `default` | no |
| subnets | AWS subnet ids | list | `<list>` | no |
Expand Down
4 changes: 1 addition & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ resource "aws_security_group" "default" {
from_port = 22
to_port = 22

cidr_blocks = [
"0.0.0.0/0",
]
cidr_blocks = ["${var.allowed_cidr_blocks}"]
}

ingress {
Expand Down
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ variable "security_groups" {
description = "AWS security group ids"
}

variable "allowed_cidr_blocks" {
type = "list"
description = "A list of CIDR blocks allowed to connect"

default = [
"0.0.0.0/0",
]
}

variable "user_data_file" {
default = "user_data.sh"
description = "User data file"
Expand Down

0 comments on commit 309ab85

Please sign in to comment.