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

WIP: Update module for terraform 0.12 #119

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data "aws_vpc" "default" {

data "aws_security_group" "default" {
name = "default"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id
}

##################################################
Expand All @@ -32,7 +32,7 @@ module "main_sg" {

name = "main-sg"
description = "Security group which is used as an argument in complete-sg"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_cidr_blocks = ["10.10.0.0/16"]
ingress_rules = ["https-443-tcp"]
Expand All @@ -46,7 +46,7 @@ module "complete_sg" {

name = "complete-sg"
description = "Security group with all available arguments set (this is just an example)"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

tags = {
Cash = "king"
Expand Down Expand Up @@ -97,7 +97,7 @@ module "complete_sg" {
to_port = 25
protocol = 6
description = "Service name with vpc cidr"
cidr_blocks = "${module.vpc.vpc_cidr_block}"
cidr_blocks = module.vpc.vpc_cidr_block
},
]

Expand Down Expand Up @@ -130,28 +130,28 @@ module "complete_sg" {
ingress_with_source_security_group_id = [
{
rule = "mysql-tcp"
source_security_group_id = "${data.aws_security_group.default.id}"
source_security_group_id = data.aws_security_group.default.id
},
{
from_port = 10
to_port = 10
protocol = 6
description = "Service name"
source_security_group_id = "${data.aws_security_group.default.id}"
source_security_group_id = data.aws_security_group.default.id
},
]

computed_ingress_with_source_security_group_id = [
{
rule = "postgresql-tcp"
source_security_group_id = "${module.main_sg.this_security_group_id}"
source_security_group_id = module.main_sg.this_security_group_id
},
{
from_port = 23
to_port = 23
protocol = 6
description = "Service name"
source_security_group_id = "${module.main_sg.this_security_group_id}"
source_security_group_id = module.main_sg.this_security_group_id
},
]

Expand Down Expand Up @@ -225,7 +225,7 @@ module "complete_sg" {
computed_egress_with_cidr_blocks = [
{
rule = "https-443-tcp"
cidr_blocks = "${module.vpc.vpc_cidr_block}"
cidr_blocks = module.vpc.vpc_cidr_block
},
]

Expand Down Expand Up @@ -258,21 +258,21 @@ module "complete_sg" {
egress_with_source_security_group_id = [
{
rule = "mysql-tcp"
source_security_group_id = "${data.aws_security_group.default.id}"
source_security_group_id = data.aws_security_group.default.id
},
{
from_port = 10
to_port = 10
protocol = 6
description = "Service name"
source_security_group_id = "${data.aws_security_group.default.id}"
source_security_group_id = data.aws_security_group.default.id
},
]

computed_egress_with_source_security_group_id = [
{
rule = "postgresql-tcp"
source_security_group_id = "${module.main_sg.this_security_group_id}"
source_security_group_id = module.main_sg.this_security_group_id
},
]

Expand Down Expand Up @@ -315,7 +315,7 @@ module "ipv4_ipv6_example" {

name = "ipv4-ipv6-example"
description = "IPv4 and IPv6 example"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_with_cidr_blocks = [
{
Expand Down Expand Up @@ -366,10 +366,11 @@ module "fixed_name_sg" {

name = "fixed-name-sg"
description = "Security group with fixed name"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

use_name_prefix = false

ingress_cidr_blocks = ["10.10.0.0/16"]
ingress_rules = ["https-443-tcp"]
}

11 changes: 6 additions & 5 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
output "this_security_group_id" {
description = "The ID of the security group"
value = "${module.complete_sg.this_security_group_id}"
value = module.complete_sg.this_security_group_id
}

output "this_security_group_vpc_id" {
description = "The VPC ID"
value = "${module.complete_sg.this_security_group_vpc_id}"
value = module.complete_sg.this_security_group_vpc_id
}

output "this_security_group_owner_id" {
description = "The owner ID"
value = "${module.complete_sg.this_security_group_owner_id}"
value = module.complete_sg.this_security_group_owner_id
}

output "this_security_group_name" {
description = "The name of the security group"
value = "${module.complete_sg.this_security_group_name}"
value = module.complete_sg.this_security_group_name
}

output "this_security_group_description" {
description = "The description of the security group"
value = "${module.complete_sg.this_security_group_description}"
value = module.complete_sg.this_security_group_description
}

4 changes: 4 additions & 0 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
11 changes: 6 additions & 5 deletions examples/computed/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data "aws_vpc" "default" {

data "aws_security_group" "default" {
name = "default"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id
}

###########################
Expand All @@ -22,14 +22,14 @@ module "http_sg" {

name = "computed-http-sg"
description = "Security group with HTTP port open for everyone, and HTTPS open just for the default security group"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_cidr_blocks = ["0.0.0.0/0"]

ingress_with_source_security_group_id = [
{
rule = "https-443-tcp"
source_security_group_id = "${data.aws_security_group.default.id}"
source_security_group_id = data.aws_security_group.default.id
},
]
}
Expand All @@ -39,16 +39,17 @@ module "mysql_sg" {

name = "computed-mysql-sg"
description = "Security group with MySQL/Aurora port open for HTTP security group created above (computed)"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_cidr_blocks = ["0.0.0.0/0"]

computed_ingress_with_source_security_group_id = [
{
rule = "mysql-tcp"
source_security_group_id = "${module.http_sg.this_security_group_id}"
source_security_group_id = module.http_sg.this_security_group_id
},
]

number_of_computed_ingress_with_source_security_group_id = 1
}

11 changes: 6 additions & 5 deletions examples/computed/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
output "this_security_group_id" {
description = "The ID of the security group"
value = "${module.mysql_sg.this_security_group_id}"
value = module.mysql_sg.this_security_group_id
}

output "this_security_group_vpc_id" {
description = "The VPC ID"
value = "${module.mysql_sg.this_security_group_vpc_id}"
value = module.mysql_sg.this_security_group_vpc_id
}

output "this_security_group_owner_id" {
description = "The owner ID"
value = "${module.mysql_sg.this_security_group_owner_id}"
value = module.mysql_sg.this_security_group_owner_id
}

output "this_security_group_name" {
description = "The name of the security group"
value = "${module.mysql_sg.this_security_group_name}"
value = module.mysql_sg.this_security_group_name
}

output "this_security_group_description" {
description = "The description of the security group"
value = "${module.mysql_sg.this_security_group_description}"
value = module.mysql_sg.this_security_group_description
}

4 changes: 4 additions & 0 deletions examples/computed/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
7 changes: 4 additions & 3 deletions examples/disabled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data "aws_vpc" "default" {

data "aws_security_group" "default" {
name = "default"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id
}

########################################################
Expand All @@ -23,7 +23,7 @@ module "complete_sg_disabled" {
create = false
name = "complete-sg"
description = "Security group with all available arguments set (this is just an example)"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_cidr_blocks = ["0.0.0.0/0"]
}
Expand All @@ -34,7 +34,8 @@ module "http_sg_disabled" {
create = false
name = "http-sg"
description = "Security group with HTTP ports open for everybody (IPv4 CIDR), egress ports are all world open"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_cidr_blocks = ["0.0.0.0/0"]
}

3 changes: 2 additions & 1 deletion examples/disabled/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
output "this_security_group_id" {
description = "The ID of the security group"
value = "${module.complete_sg_disabled.this_security_group_id}"
value = module.complete_sg_disabled.this_security_group_id
}

4 changes: 4 additions & 0 deletions examples/disabled/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
7 changes: 4 additions & 3 deletions examples/dynamic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data "aws_vpc" "default" {

data "aws_security_group" "default" {
name = "default"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id
}

###########################
Expand All @@ -26,14 +26,15 @@ module "http_sg" {

name = "dynamic-http-sg"
description = "Security group with HTTP port open for everyone, and HTTPS open just for the default security group"
vpc_id = "${data.aws_vpc.default.id}"
vpc_id = data.aws_vpc.default.id

ingress_cidr_blocks = ["0.0.0.0/0"]

ingress_with_source_security_group_id = [
{
rule = "https-443-tcp"
source_security_group_id = "${data.aws_security_group.default.id}"
source_security_group_id = data.aws_security_group.default.id
},
]
}

11 changes: 6 additions & 5 deletions examples/dynamic/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
output "this_security_group_id" {
description = "The ID of the security group"
value = "${module.http_sg.this_security_group_id}"
value = module.http_sg.this_security_group_id
}

output "this_security_group_vpc_id" {
description = "The VPC ID"
value = "${module.http_sg.this_security_group_vpc_id}"
value = module.http_sg.this_security_group_vpc_id
}

output "this_security_group_owner_id" {
description = "The owner ID"
value = "${module.http_sg.this_security_group_owner_id}"
value = module.http_sg.this_security_group_owner_id
}

output "this_security_group_name" {
description = "The name of the security group"
value = "${module.http_sg.this_security_group_name}"
value = module.http_sg.this_security_group_name
}

output "this_security_group_description" {
description = "The description of the security group"
value = "${module.http_sg.this_security_group_description}"
value = module.http_sg.this_security_group_description
}

4 changes: 4 additions & 0 deletions examples/dynamic/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
Loading