File tree Expand file tree Collapse file tree 8 files changed +18
-24
lines changed
Expand file tree Collapse file tree 8 files changed +18
-24
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,11 @@ data "aws_iam_policy_document" "iam-policy" {
123123module "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
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff line change @@ -136,9 +136,9 @@ data "aws_iam_policy_document" "kms" {
136136module "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"
Original file line number Diff line number Diff 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}
Load Diff This file was deleted.
Original file line number Diff line number Diff 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}
Load Diff This file was deleted.
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments