Skip to content

Commit 89edf54

Browse files
committed
fix terratest
1 parent 9c61d62 commit 89edf54

File tree

8 files changed

+18
-24
lines changed

8 files changed

+18
-24
lines changed

_example/basic_example/example.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ data "aws_iam_policy_document" "iam-policy" {
123123
module "ec2" {
124124
source = "./../../"
125125

126-
name = "ec2-instance"
126+
name = "ec2"
127127
environment = "test"
128128
label_order = ["name", "environment"]
129129

130-
instance_count = 2
130+
instance_count = 1
131131
ami = "ami-08d658f84a6d84a80"
132132
instance_type = "t2.nano"
133133
monitoring = false

_example/basic_example/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ output "instance_id" {
22
value = module.ec2.*.instance_id
33
description = "The instance ID."
44
}
5+
6+
output "tags" {
7+
value = module.ec2.tags
8+
description = "The instance ID."
9+
}

_example/secure_example/example.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ data "aws_iam_policy_document" "kms" {
136136
module "ec2" {
137137
source = "./../../"
138138

139-
name = "ec2-instance"
139+
name = "ec2"
140140
environment = "test"
141-
label_order = ["environment", "name"]
141+
label_order = ["name", "environment"]
142142

143143
instance_count = 2
144144
ami = "ami-08d658f84a6d84a80"

_test/basic_example/ec2_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func Test(t *testing.T) {
2525
defer terraform.Destroy(t, terraformOptions)
2626

2727
// To get the value of an output variable, run 'terraform output'
28-
Id := terraform.Output(t, terraformOptions, "instance_id")
28+
Tags := terraform.OutputMap(t, terraformOptions, "tags")
2929

3030
// Check that we get back the outputs that we expect
31-
assert.Contains(t, Id, "i-")
31+
assert.Equal(t, "ec2-test", Tags["Name"])
3232
}

_test/basic_example/go.mod

Lines changed: 0 additions & 8 deletions
This file was deleted.

_test/secure_example/ec2_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func Test(t *testing.T) {
2525
defer terraform.Destroy(t, terraformOptions)
2626

2727
// To get the value of an output variable, run 'terraform output'
28-
Id := terraform.Output(t, terraformOptions, "instance_id")
28+
Tags := terraform.OutputMap(t, terraformOptions, "tags")
2929

3030
// Check that we get back the outputs that we expect
31-
assert.Contains(t, Id, "i-")
31+
assert.Equal(t, "ec2-test", Tags["Name"])
3232
}

_test/secure_example/go.mod

Lines changed: 0 additions & 8 deletions
This file was deleted.

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ output "instance_count" {
5858
value = var.instance_count
5959
description = "The count of instances."
6060
}
61+
62+
output "tags" {
63+
value = module.labels.tags
64+
description = "The instance ID."
65+
}

0 commit comments

Comments
 (0)