Skip to content

Commit e2ac866

Browse files
chrizkimhyder
authored andcommitted
fix: Remove unknown resource counts from derived inputs
Signed-off-by: Christopher Kim <[email protected]>
1 parent df62b3d commit e2ac866

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

module-iam.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
data "oci_identity_availability_domains" "all" {
5-
compartment_id = local.compartment_id
5+
compartment_id = local.tenancy_id != "unknown" ? local.tenancy_id : local.compartment_id
66
}
77

88
locals {

module-network.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
data "oci_core_vcn" "oke" {
5-
count = coalesce(var.vcn_id, "none") != "none" ? 1 : 0
5+
count = var.create_vcn ? 0 : 1
66
vcn_id = coalesce(var.vcn_id, "none")
77
}
88

modules/iam/tagging.tf

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ data "oci_identity_tag_namespaces" "oke" {
1313
state = "ACTIVE" // TODO Support reactivation of retired namespace w/ update
1414
}
1515

16-
data "oci_identity_tags" "oke" {
17-
count = var.create_iam_resources && local.tag_namespace_id_found != null ? 1 : 0
18-
provider = oci.home
19-
tag_namespace_id = local.tag_namespace_id_found
20-
state = "ACTIVE" // TODO Support reactivation of retired tag w/ update
21-
}
22-
2316
locals {
2417
# Filtered value from data source (only 1 by name, or null)
2518
# Identified tag namespace ID when not created and used
@@ -31,7 +24,6 @@ locals {
3124
var.create_iam_resources,
3225
var.create_iam_tag_namespace,
3326
local.tag_namespace_id_found == null,
34-
one(data.oci_identity_tags.oke[*].tags) == null,
3527
])
3628

3729
# Map of standard tags & descriptions to be created if enabled
@@ -64,17 +56,17 @@ resource "oci_identity_tag_namespace" "oke" {
6456
description = "Tag namespace for OKE resources"
6557
name = var.tag_namespace
6658
# defined_tags = local.defined_tags
67-
freeform_tags = local.freeform_tags
59+
freeform_tags = local.freeform_tags
6860
lifecycle {
6961
ignore_changes = [defined_tags, freeform_tags]
7062
}
7163
}
7264

7365
resource "oci_identity_tag" "oke" {
74-
provider = oci.home
75-
for_each = local.create_iam_tag_namespace ? local.tags : {} #{ for k, v in oci_identity_tag_namespace.oke : k => local.tags } # local.create_iam_tag_namespace ? local.tags : {}
76-
description = each.value
77-
name = each.key
66+
provider = oci.home
67+
for_each = local.create_iam_tag_namespace ? local.tags : {} #{ for k, v in oci_identity_tag_namespace.oke : k => local.tags } # local.create_iam_tag_namespace ? local.tags : {}
68+
description = each.value
69+
name = each.key
7870
# defined_tags = local.defined_tags
7971
freeform_tags = local.freeform_tags
8072
tag_namespace_id = one(oci_identity_tag_namespace.oke[*].id)

modules/network/subnets.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ locals {
7979
# - Subnet is configured with newbits and/or netnum/cidr
8080
# - Not configured with create == 'never'
8181
# - Not configured with an existing 'id'
82-
subnets_to_create = length(var.vcn_cidrs) > 0 ? merge(
82+
subnets_to_create = merge(
8383
{ for k, v in local.subnet_info : k =>
8484
# Override `create = true` if configured with "always"
8585
merge(v, lookup(try(lookup(var.subnets, k), { create = "never" }), "create", "auto") == "always" ? { "create" = true } : {})
@@ -92,7 +92,7 @@ locals {
9292
]),
9393
])
9494
}
95-
) : {}
95+
)
9696

9797
subnet_output = { for k, v in var.subnets :
9898
k => lookup(v, "id", null) != null ? v.id : lookup(lookup(oci_core_subnet.oke, k, {}), "id", null)

0 commit comments

Comments
 (0)