Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion examples/no-prefix/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module "slz_vpc" {
source = "../../"
resource_group_id = module.resource_group.resource_group_id
region = var.region
name = "vpc"
name = var.vpc_name
routing_table_name = "vpc-routing-table"
public_gateway_name = "vpc-public-gateway"
vpc_flow_logs_name = "vpc-flow-logs"
Expand Down
6 changes: 6 additions & 0 deletions examples/no-prefix/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ variable "access_tags" {
description = "Optional list of access tags to add to the VPC resources that are created"
default = []
}

variable "vpc_name" {
type = string
description = "Name of the VPC"
default = "vpc"
}
5 changes: 5 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ func TestRunNoPrefixExample(t *testing.T) {
t.Parallel()

options := setupOptions(t, "no-prefix-lz", noprefixExampleTerraformDir)
options.TerraformVars = map[string]interface{}{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setupOptions will have already created a TerraformVars map with region+prefix+etc already set.

In this case you would want to just add a new entry to the existing map, instead of creating a whole new map.

I think you just need one line here, options.TerraformVars["vpc_name"] = fmt.Sprintf("%s-vpc", options.Prefix)

That should add a new vpc_name map entry to the exiting map.

"prefix": options.Prefix,
"region": options.Region,
"vpc_name": fmt.Sprintf("%s-vpc", options.Prefix),
}

output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
Expand Down