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

fix: vpc data lookup #798

Merged
merged 13 commits into from
Jun 6, 2024
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ data "ibm_is_vpc" "vpc" {
}

locals {
vpc_id = var.create_vpc ? resource.ibm_is_vpc.vpc[0].id : var.existing_vpc_id
vpc_id = var.create_vpc ? resource.ibm_is_vpc.vpc[0].id : var.existing_vpc_id
vpc_name = var.create_vpc ? resource.ibm_is_vpc.vpc[0].name : data.ibm_is_vpc.vpc.name
vpc_crn = var.create_vpc ? resource.ibm_is_vpc.vpc[0].crn : data.ibm_is_vpc.vpc.crn
}

##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

output "vpc_name" {
description = "Name of VPC created"
value = data.ibm_is_vpc.vpc.resource_name
value = local.vpc_name
}

output "vpc_id" {
Expand All @@ -14,7 +14,7 @@ output "vpc_id" {

output "vpc_crn" {
description = "CRN of VPC created"
value = data.ibm_is_vpc.vpc.crn
value = local.vpc_crn
}

##############################################################################
Expand Down