Skip to content

Commit 5afb3cc

Browse files
authored
Merge pull request #8 from ddosia/dch_fix_warnings
Fix warnings
2 parents 8dd5b0f + 30b38ee commit 5afb3cc

File tree

21 files changed

+143
-143
lines changed

21 files changed

+143
-143
lines changed

modules/bastion/iam.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_iam_instance_profile" "s3_readonly" {
22
name = "${var.name}-s3-readonly"
3-
role = "${aws_iam_role.s3_readonly.name}"
3+
role = aws_iam_role.s3_readonly.name
44
}
55

66
resource "aws_iam_role" "s3_readonly" {
@@ -25,7 +25,7 @@ EOF
2525

2626
resource "aws_iam_role_policy" "s3_readonly_policy" {
2727
name = "${var.name}-s3-readonly-policy"
28-
role = "${aws_iam_role.s3_readonly.id}"
28+
role = aws_iam_role.s3_readonly.id
2929

3030
policy = <<EOF
3131
{
@@ -38,7 +38,7 @@ resource "aws_iam_role_policy" "s3_readonly_policy" {
3838
"s3:Get*"
3939
],
4040
"Resource": [
41-
"${var.s3_bucket_arn}",
41+
var.s3_bucket_arn,
4242
"${var.s3_bucket_arn}/*"
4343
]
4444
}

modules/bastion/main.tf

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
resource "aws_security_group" "bastion" {
2-
name = "${var.name}"
3-
vpc_id = "${var.vpc_id}"
2+
name = var.name
3+
vpc_id = var.vpc_id
44
description = "Bastion security group (only SSH inbound access is allowed)"
55

66
tags {
7-
Name = "${var.name}"
7+
Name = var.name
88
}
99

1010
ingress {
1111
protocol = "tcp"
1212
from_port = 22
1313
to_port = 22
1414

15-
cidr_blocks = "${var.allow_ssh_cidrs}"
15+
cidr_blocks = var.allow_ssh_cidrs
1616
}
1717

1818
egress {
@@ -31,48 +31,48 @@ resource "aws_security_group" "bastion" {
3131
}
3232

3333
data "template_file" "user_data" {
34-
template = "${file("${path.module}/user-data/user-data.sh")}"
35-
36-
vars {
37-
s3_bucket_name = "${var.s3_bucket_name}"
38-
s3_bucket_uri = "${var.s3_bucket_uri}"
39-
ssh_user = "${var.ssh_user}"
40-
keys_update_frequency = "${var.keys_update_frequency}"
41-
enable_hourly_cron_updates = "${var.enable_hourly_cron_updates}"
42-
additional_user_data_script = "${var.additional_user_data_script}"
34+
template = file("${path.module}/user-data/user-data.sh")
35+
36+
vars = {
37+
s3_bucket_name = var.s3_bucket_name
38+
s3_bucket_uri = var.s3_bucket_uri
39+
ssh_user = var.ssh_user
40+
keys_update_frequency = var.keys_update_frequency
41+
enable_hourly_cron_updates = var.enable_hourly_cron_updates
42+
additional_user_data_script = var.additional_user_data_script
4343
}
4444
}
4545

4646
resource "aws_launch_configuration" "bastion" {
47-
name_prefix = "${var.name}"
48-
image_id = "${var.ami}"
49-
instance_type = "${var.instance_type}"
50-
key_name = "${var.keypair}"
51-
user_data = "${data.template_file.user_data.rendered}"
52-
associate_public_ip_address = "${var.associate_public_ip_address}"
47+
name_prefix = var.name
48+
image_id = var.ami
49+
instance_type = var.instance_type
50+
key_name = var.keypair
51+
user_data = data.template_file.user_data.rendered
52+
associate_public_ip_address = var.associate_public_ip_address
5353

5454
security_groups = [
55-
"${compact(concat(list(aws_security_group.bastion.id), split(",", "${var.security_group_ids}")))}",
55+
compact(concat(list(aws_security_group.bastion.id), split(",", var.security_group_ids))),
5656
]
5757

58-
iam_instance_profile = "${aws_iam_instance_profile.s3_readonly.name}"
58+
iam_instance_profile = aws_iam_instance_profile.s3_readonly.name
5959

6060
lifecycle {
6161
create_before_destroy = true
6262
}
6363
}
6464

6565
resource "aws_autoscaling_group" "bastion" {
66-
name = "${var.name}"
67-
vpc_zone_identifier = ["${split(",", var.subnet_ids)}"]
66+
name = var.name
67+
vpc_zone_identifier = [split(",", var.subnet_ids)]
6868
desired_capacity = "1"
6969
min_size = "1"
7070
max_size = "1"
7171
health_check_grace_period = "60"
7272
health_check_type = "EC2"
7373
force_delete = false
7474
wait_for_capacity_timeout = 0
75-
launch_configuration = "${aws_launch_configuration.bastion.name}"
75+
launch_configuration = aws_launch_configuration.bastion.name
7676

7777
enabled_metrics = [
7878
"GroupMinSize",
@@ -87,13 +87,13 @@ resource "aws_autoscaling_group" "bastion" {
8787

8888
tag {
8989
key = "Name"
90-
value = "${var.name}"
90+
value = var.name
9191
propagate_at_launch = true
9292
}
9393

9494
tag {
9595
key = "EIP"
96-
value = "${var.eip}"
96+
value = var.eip
9797
propagate_at_launch = true
9898
}
9999

modules/bastion/output.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
output "ssh_user" {
2-
value = "${var.ssh_user}"
2+
value = var.ssh_user
33
}
44

55
output "security_group_id" {
6-
value = "${aws_security_group.bastion.id}"
6+
value = aws_security_group.bastion.id
77
}

modules/bastion/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ variable "associate_public_ip_address" {
5858

5959
variable "allow_ssh_cidrs" {
6060
description = "List Cidrs from where ssh is to be allowed for bastion host. Default is anywhere"
61-
type = "list"
61+
type = list
6262
default = ["0.0.0.0/0"]
6363
}
6464

modules/nat/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
resource "aws_eip" "nat" {
22
vpc = true
33

4-
count = "${length(var.azs)}" # Comment out count to only have 1 NAT
4+
count = length(var.azs) # Comment out count to only have 1 NAT
55

66
lifecycle {
77
create_before_destroy = true
88
}
99
}
1010

1111
resource "aws_nat_gateway" "nat" {
12-
count = "${length(var.azs)}" # Comment out count to only have 1 NAT
12+
count = length(var.azs) # Comment out count to only have 1 NAT
1313

14-
allocation_id = "${element(aws_eip.nat.*.id, count.index)}"
15-
subnet_id = "${element(split(",", var.public_subnet_ids), count.index)}"
14+
allocation_id = element(aws_eip.nat.*.id, count.index)
15+
subnet_id = element(split(",", var.public_subnet_ids), count.index)
1616

1717
lifecycle {
1818
create_before_destroy = true

modules/nat/output.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
output "nat_gateway_ids" {
2-
value = "${join(",", aws_nat_gateway.nat.*.id)}"
2+
value = join(",", aws_nat_gateway.nat.*.id)
33
}
44

55
output "public_ip" {
6-
value = "${aws_eip.nat.public_ip}"
6+
value = aws_eip.nat.public_ip
77
}

modules/network-acl/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_network_acl" "acl" {
2-
vpc_id = "${var.vpc_id}"
3-
subnet_ids = ["${concat(split(",", var.public_subnet_ids), split(",", var.private_app_subnet_ids))}"]
2+
vpc_id = var.vpc_id
3+
subnet_ids = [concat(split(",", var.public_subnet_ids), split(",", var.private_app_subnet_ids))]
44

55
ingress {
66
protocol = "-1"
@@ -21,6 +21,6 @@ resource "aws_network_acl" "acl" {
2121
}
2222

2323
tags {
24-
Name = "${var.name}"
24+
Name = var.name
2525
}
2626
}

modules/network-acl/output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
output "network_acl_id" {
2-
value = "${aws_network_acl.acl.id}"
2+
value = aws_network_acl.acl.id
33
}

0 commit comments

Comments
 (0)