Skip to content

Commit fe27e6f

Browse files
authored
fix: vpc data lookup (#798)
1 parent 8e68e56 commit fe27e6f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ data "ibm_is_vpc" "vpc" {
5252
}
5353

5454
locals {
55-
vpc_id = var.create_vpc ? resource.ibm_is_vpc.vpc[0].id : var.existing_vpc_id
55+
vpc_id = var.create_vpc ? resource.ibm_is_vpc.vpc[0].id : var.existing_vpc_id
56+
vpc_name = var.create_vpc ? resource.ibm_is_vpc.vpc[0].name : data.ibm_is_vpc.vpc.name
57+
vpc_crn = var.create_vpc ? resource.ibm_is_vpc.vpc[0].crn : data.ibm_is_vpc.vpc.crn
5658
}
5759

5860
##############################################################################

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
output "vpc_name" {
66
description = "Name of VPC created"
7-
value = data.ibm_is_vpc.vpc.resource_name
7+
value = local.vpc_name
88
}
99

1010
output "vpc_id" {
@@ -14,7 +14,7 @@ output "vpc_id" {
1414

1515
output "vpc_crn" {
1616
description = "CRN of VPC created"
17-
value = data.ibm_is_vpc.vpc.crn
17+
value = local.vpc_crn
1818
}
1919

2020
##############################################################################

0 commit comments

Comments
 (0)