Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving secondary_ranges to a key under subnets. #69

Closed
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
Prev Previous commit
Next Next commit
feat: test to check duplicate named network in diff regions
Adding in a test to confirm that you can create a network with a duplicate name in a differnet region, and that the secondary subnets are correct
tfhartmann committed Sep 13, 2019
commit 84cc1a7b23203dc02674874361b235b7481988bc
18 changes: 18 additions & 0 deletions examples/secondary_ranges/main.tf
Original file line number Diff line number Diff line change
@@ -85,6 +85,24 @@ module "vpc-secondary-ranges" {
description = ""
secondary_ranges = []
},
{
subnet_name = "${local.subnet_01}"
subnet_ip = "10.10.50.0/24"
subnet_region = "us-central1"
subnet_private_access = "false"
subnet_flow_logs = "false"
description = ""
secondary_ranges = [
{
range_name = "${local.subnet_01}-01"
ip_cidr_range = "192.168.67.0/24"
},
{
range_name = "${local.subnet_01}-02"
ip_cidr_range = "192.168.68.0/24"
},
]
},
]

}
27 changes: 27 additions & 0 deletions test/integration/secondary_ranges/controls/gcloud.rb
Original file line number Diff line number Diff line change
@@ -45,6 +45,33 @@
end
end

describe command("gcloud compute networks subnets describe #{network_name}-subnet-01 --project=#{project_id} --region=us-central1 --format=json") do
its(:exit_status) { should eq 0 }
its(:stderr) { should eq '' }

let(:data) do
if subject.exit_status == 0
JSON.parse(subject.stdout)
else
{}
end
end

it "should have the correct secondaryIpRanges configuration for #{network_name}-subnet-01-01" do
expect(data["secondaryIpRanges"][0]).to include(
"rangeName" => "#{network_name}-subnet-01-01",
"ipCidrRange" => "192.168.67.0/24"
)
end

it "should have the correct secondaryIpRanges configuration for #{network_name}-subnet-01-02" do
expect(data["secondaryIpRanges"][1]).to include(
"rangeName" => "#{network_name}-subnet-01-02",
"ipCidrRange" => "192.168.68.0/24"
)
end
end

describe command("gcloud compute networks subnets describe #{network_name}-subnet-02 --project=#{project_id} --region=us-west1 --format=json") do
its(:exit_status) { should eq 0 }
its(:stderr) { should eq '' }