Skip to content

Commit 78a5321

Browse files
authored
Merge pull request #6 from clouddrove/CD-150
Add Security Group IDs ingress Role
2 parents c5b3834 + 53848d4 commit 78a5321

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ This module has a few dependencies:
7272
Here is an example of how you can use this module in your inventory structure:
7373
```hcl
7474
module "security_group" {
75-
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.4"
75+
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.5"
7676
name = "security-group"
7777
application = "clouddrove"
7878
environment = "test"
@@ -93,25 +93,25 @@ Here is an example of how you can use this module in your inventory structure:
9393

9494
| Name | Description | Type | Default | Required |
9595
|------|-------------|:----:|:-----:|:-----:|
96-
| allowed\_ip | List of allowed ip. | list | `<list>` | no |
97-
| allowed\_ports | List of allowed ingress ports. | list | `<list>` | no |
98-
| application | Application \(e.g. `cd` or `clouddrove`\). | string | `""` | no |
99-
| description | The security group description. | string | `"Instance default security group (only egress access is allowed)."` | no |
100-
| enable\_security\_group | Enable default Security Group with only Egress traffic allowed. | bool | `"true"` | no |
101-
| environment | Environment \(e.g. `prod`, `dev`, `staging`\). | string | `""` | no |
102-
| label\_order | Label order, e.g. `name`,`application`. | list | `<list>` | no |
103-
| managedby | ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'. | string | `"[email protected]"` | no |
104-
| name | Name \(e.g. `app` or `cluster`\). | string | `""` | no |
105-
| protocol | The protocol. If not icmp, tcp, udp, or all use the. | string | `"tcp"` | no |
106-
| security\_groups | List of Security Group IDs allowed to connect to the instance. | list | `<list>` | no |
107-
| tags | Additional tags \(e.g. map\(`BusinessUnit`,`XYZ`\). | map(string) | `<map>` | no |
108-
| vpc\_id | The ID of the VPC that the instance security group belongs to. | string | `""` | no |
96+
| allowed_ip | List of allowed ip. | list | `<list>` | no |
97+
| allowed_ports | List of allowed ingress ports. | list | `<list>` | no |
98+
| application | Application (e.g. `cd` or `clouddrove`). | string | `` | no |
99+
| description | The security group description. | string | `Instance default security group (only egress access is allowed).` | no |
100+
| enable_security_group | Enable default Security Group with only Egress traffic allowed. | bool | `true` | no |
101+
| environment | Environment (e.g. `prod`, `dev`, `staging`). | string | `` | no |
102+
| label_order | Label order, e.g. `name`,`application`. | list | `<list>` | no |
103+
| managedby | ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'. | string | `[email protected]` | no |
104+
| name | Name (e.g. `app` or `cluster`). | string | `` | no |
105+
| protocol | The protocol. If not icmp, tcp, udp, or all use the. | string | `tcp` | no |
106+
| security_groups | List of Security Group IDs allowed to connect to the instance. | list(string) | `<list>` | no |
107+
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`). | map(string) | `<map>` | no |
108+
| vpc_id | The ID of the VPC that the instance security group belongs to. | string | `` | no |
109109

110110
## Outputs
111111

112112
| Name | Description |
113113
|------|-------------|
114-
| security\_group\_ids | IDs on the AWS Security Groups associated with the instance. |
114+
| security_group_ids | IDs on the AWS Security Groups associated with the instance. |
115115
| tags | A mapping of public tags to assign to the resource. |
116116

117117

README.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ usage : |-
3636
Here is an example of how you can use this module in your inventory structure:
3737
```hcl
3838
module "security_group" {
39-
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.4"
39+
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.5"
4040
name = "security-group"
4141
application = "clouddrove"
4242
environment = "test"

_example/example.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ provider "aws" {
33
}
44

55
module "vpc" {
6-
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.4"
6+
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.5"
77

88
name = "vpc"
99
application = "clouddrove"

main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ resource "aws_security_group_rule" "egress" {
5050
to_port = 65535
5151
protocol = "-1"
5252
cidr_blocks = ["0.0.0.0/0"]
53-
security_group_id = aws_security_group.default[0].id
53+
security_group_id = join("", aws_security_group.default.*.id)
5454
}
5555

5656
#Module : SECURITY GROUP RULE FOR INGRESS
@@ -64,7 +64,7 @@ resource "aws_security_group_rule" "ingress" {
6464
to_port = element(var.allowed_ports, count.index)
6565
protocol = var.protocol
6666
cidr_blocks = var.allowed_ip
67-
security_group_id = aws_security_group.default[0].id
67+
security_group_id = join("", aws_security_group.default.*.id)
6868
}
6969

7070
resource "aws_security_group_rule" "ingress_sg" {
@@ -75,5 +75,5 @@ resource "aws_security_group_rule" "ingress_sg" {
7575
to_port = element(element(local.ports_source_sec_group_product, count.index), 0)
7676
protocol = var.protocol
7777
source_security_group_id = element(element(local.ports_source_sec_group_product, count.index), 1)
78-
security_group_id = aws_security_group.default[0].id
78+
security_group_id = join("", aws_security_group.default.*.id)
7979
}

variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ variable "allowed_ip" {
6969
}
7070

7171
variable "security_groups" {
72-
type = list
72+
type = list(string)
7373
default = []
7474
description = "List of Security Group IDs allowed to connect to the instance."
7575
}

0 commit comments

Comments
 (0)