Skip to content

Commit

Permalink
fix terratest
Browse files Browse the repository at this point in the history
  • Loading branch information
yadavprakash committed Jul 7, 2021
1 parent 9c61d62 commit 89edf54
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 24 deletions.
4 changes: 2 additions & 2 deletions _example/basic_example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ data "aws_iam_policy_document" "iam-policy" {
module "ec2" {
source = "./../../"

name = "ec2-instance"
name = "ec2"
environment = "test"
label_order = ["name", "environment"]

instance_count = 2
instance_count = 1
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
monitoring = false
Expand Down
5 changes: 5 additions & 0 deletions _example/basic_example/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ output "instance_id" {
value = module.ec2.*.instance_id
description = "The instance ID."
}

output "tags" {
value = module.ec2.tags
description = "The instance ID."
}
4 changes: 2 additions & 2 deletions _example/secure_example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ data "aws_iam_policy_document" "kms" {
module "ec2" {
source = "./../../"

name = "ec2-instance"
name = "ec2"
environment = "test"
label_order = ["environment", "name"]
label_order = ["name", "environment"]

instance_count = 2
ami = "ami-08d658f84a6d84a80"
Expand Down
4 changes: 2 additions & 2 deletions _test/basic_example/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func Test(t *testing.T) {
defer terraform.Destroy(t, terraformOptions)

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

// Check that we get back the outputs that we expect
assert.Contains(t, Id, "i-")
assert.Equal(t, "ec2-test", Tags["Name"])
}
8 changes: 0 additions & 8 deletions _test/basic_example/go.mod

This file was deleted.

4 changes: 2 additions & 2 deletions _test/secure_example/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func Test(t *testing.T) {
defer terraform.Destroy(t, terraformOptions)

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

// Check that we get back the outputs that we expect
assert.Contains(t, Id, "i-")
assert.Equal(t, "ec2-test", Tags["Name"])
}
8 changes: 0 additions & 8 deletions _test/secure_example/go.mod

This file was deleted.

5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ output "instance_count" {
value = var.instance_count
description = "The count of instances."
}

output "tags" {
value = module.labels.tags
description = "The instance ID."
}

0 comments on commit 89edf54

Please sign in to comment.