Hi,
I have a root module that calls a child module as so:
Root module:
main.tf
:
module "repo-1" {
source = "../../terraform-github-repository"
repository_name = "example-repo-1"
}
variables.tf
:
variable "repository_defaults" {
description = "Default repository Settings"
default = {}
}
terraform.tfvars
:
repository_defaults = {
allow_auto_merge = true
}
Child module:
main.tf
:
locals {
allow_auto_merge = lookup(var.repository_defaults, "allow_auto_merge", var.repository_allow_auto_merge)
}
resource "github_repository" "main" {
name = var.repository_name
allow_auto_merge = local.allow_auto_merge
}
variables.tf
:
variable "repository_name" {
description = "The name of the repository."
type = string
}
variable "repository_defaults" {
description = "Default repository Settings"
default = {}
}
variable "repository_allow_auto_merge" {
description = "Allow auto-merging pull requests on the repository."
default = null
type = bool
}
I can not seem to get the value of var.repository_defaults, "allow_auto_merge"
to be used by the root module when calling the child module?
What am I missing in how terraform.tfvars
is used in a root module?
Thanks so much for any pointers you can provide.