Skip to content

Commit

Permalink
Use wrapper module to work around upstream issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pst committed Jul 23, 2022
1 parent 8b8e6af commit 29c4ea6
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 67 deletions.
68 changes: 1 addition & 67 deletions common/configuration/tests/non_string_values/test_object.tf
Original file line number Diff line number Diff line change
@@ -1,71 +1,5 @@
variable "test_configuration" {
type = map(object({
test_string = optional(string)
test_list_string = optional(list(string))
test_map_string = optional(map(string))
test_list_object = optional(list(object({
key = string
})))
test_object = optional(object({
key = string
}))
}))
description = "Map with per workspace module configuration."
default = {
apps = {
test_string = "from_apps"

test_list_string = [
"from_apps"
]

test_map_string = {
key = "from_apps"
}

test_list_object = [{
key = "from_apps"
}]

test_object = {
key = "from_apps"
}
}

ops = {
test_string = "from_ops"

test_list_string = [
"from_ops"
]

test_map_string = {
key = "from_ops"
}

test_list_object = [{
key = "from_ops"
}]

test_object = {
key = "from_ops"
}
}

loc = {
test_list_object = [{
key = "from_loc"
}]
}
}
}

module "mut_object" {
source = "../.."

configuration = var.test_configuration

base_key = "apps"
source = "./wrapper"
}

resource "test_assertions" "overwrite_object" {
Expand Down
77 changes: 77 additions & 0 deletions common/configuration/tests/non_string_values/wrapper/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
terraform {
experiments = [module_variable_optional_attrs]
}

variable "test_configuration" {
type = map(object({
test_string = optional(string)
test_list_string = optional(list(string))
test_map_string = optional(map(string))
test_list_object = optional(list(object({
key = string
})))
test_object = optional(object({
key = string
}))
}))
description = "Map with per workspace module configuration."
default = {
apps = {
test_string = "from_apps"

test_list_string = [
"from_apps"
]

test_map_string = {
key = "from_apps"
}

test_list_object = [{
key = "from_apps"
}]

test_object = {
key = "from_apps"
}
}

ops = {
test_string = "from_ops"

test_list_string = [
"from_ops"
]

test_map_string = {
key = "from_ops"
}

test_list_object = [{
key = "from_ops"
}]

test_object = {
key = "from_ops"
}
}

loc = {
test_list_object = [{
key = "from_loc"
}]
}
}
}

module "mut_object" {
source = "../../.."

configuration = var.test_configuration

base_key = "apps"
}

output "merged" {
value = module.mut_object.merged
}

0 comments on commit 29c4ea6

Please sign in to comment.