Skip to content

Commit

Permalink
fix: Resolve Invalid index error on shared vpc destroy (#177)
Browse files Browse the repository at this point in the history
Checks that google_compute_shared_vpc_host_project.shared_vpc_host
is not empty before attempting to return the value. Avoids the error
"google_compute_shared_vpc_host_project.shared_vpc_host is empty tuple
The given key does not identify an element in this collection value."
  • Loading branch information
mikemeiercb authored Apr 28, 2020
1 parent 0062602 commit b799266
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/vpc/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ output "network_self_link" {
}

output "project_id" {
value = var.shared_vpc_host ? google_compute_shared_vpc_host_project.shared_vpc_host.*.project[0] : google_compute_network.network.project
value = var.shared_vpc_host && length(google_compute_shared_vpc_host_project.shared_vpc_host) > 0 ? google_compute_shared_vpc_host_project.shared_vpc_host.*.project[0] : google_compute_network.network.project
description = "VPC project id"
}

0 comments on commit b799266

Please sign in to comment.