Merge pull request #175 from cloud-neutral-toolkit/codex/fix-missing-bootstrap.yaml-file

Fix Terragrunt bootstrap config file path
This commit is contained in:
cloudneutral 2025-12-11 00:48:06 +08:00 committed by GitHub
commit 5cb45e9bae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 31 additions and 59 deletions

View File

@ -1,5 +1,5 @@
locals {
bootstrap = yamldecode(file("${path.module}/../../config/accounts/bootstrap.yaml"))
bootstrap = yamldecode(file(abspath(var.bootstrap_config_path)))
config_account_name = coalesce(var.account_name, local.bootstrap.account_name)
config_region = coalesce(var.region, local.bootstrap.region)

View File

@ -2,39 +2,14 @@ include "root" {
path = find_in_parent_folders()
}
locals {
root_config = read_terragrunt_config(find_in_parent_folders())
bootstrap_config = local.root_config.locals.bootstrap_config
}
dependency "state" {
config_path = "../state"
mock_outputs = {
bucket_name = local.bootstrap_config.state.bucket_name
region = local.bootstrap_config.region
}
mock_outputs_allowed_terraform_commands = ["plan", "validate"]
}
dependency "lock" {
config_path = "../lock"
mock_outputs = {
dynamodb_table_name = local.bootstrap_config.state.dynamodb_table_name
region = local.bootstrap_config.region
}
mock_outputs_allowed_terraform_commands = ["plan", "validate"]
dependencies {
paths = ["../state", "../lock"]
}
terraform {
source = "./"
source = "${get_parent_terragrunt_dir()}/..//bootstrap/identity"
}
inputs = {
region = dependency.state.outputs.region
state_bucket_name = dependency.state.outputs.bucket_name
state_lock_table_name = dependency.lock.outputs.dynamodb_table_name
bootstrap_config_path = abspath("${get_parent_terragrunt_dir()}/../config/accounts/bootstrap.yaml")
}

View File

@ -73,3 +73,9 @@ variable "state_lock_table_name" {
type = string
default = null
}
variable "bootstrap_config_path" {
description = "Path to the bootstrap account configuration YAML"
type = string
default = "../../config/accounts/bootstrap.yaml"
}

View File

@ -1,5 +1,5 @@
locals {
bootstrap = yamldecode(file("${path.module}/../../config/accounts/bootstrap.yaml"))
bootstrap = yamldecode(file(abspath(var.bootstrap_config_path)))
dynamodb_table_name = coalesce(var.table_name, local.bootstrap.state.dynamodb_table_name)
region = coalesce(var.region, local.bootstrap.region)

View File

@ -2,26 +2,14 @@ include "root" {
path = find_in_parent_folders()
}
locals {
root_config = read_terragrunt_config(find_in_parent_folders())
bootstrap_config = local.root_config.locals.bootstrap_config
}
dependency "state" {
config_path = "../state"
mock_outputs = {
bucket_name = local.bootstrap_config.state.bucket_name
region = local.bootstrap_config.region
}
mock_outputs_allowed_terraform_commands = ["plan", "validate"]
dependencies {
paths = ["../state"]
}
terraform {
source = "./"
source = "${get_parent_terragrunt_dir()}/..//bootstrap/lock"
}
inputs = {
region = dependency.state.outputs.region
bootstrap_config_path = abspath("${get_parent_terragrunt_dir()}/../config/accounts/bootstrap.yaml")
}

View File

@ -9,3 +9,9 @@ variable "region" {
type = string
default = null
}
variable "bootstrap_config_path" {
description = "Path to the bootstrap account configuration YAML"
type = string
default = "../../config/accounts/bootstrap.yaml"
}

View File

@ -1,5 +1,5 @@
locals {
bootstrap = yamldecode(file("${path.module}/../../config/accounts/bootstrap.yaml"))
bootstrap = yamldecode(file(abspath(var.bootstrap_config_path)))
bucket_name = coalesce(var.bucket_name, local.bootstrap.state.bucket_name)
region = coalesce(var.region, local.bootstrap.region)

View File

@ -2,16 +2,10 @@ include "root" {
path = find_in_parent_folders()
}
locals {
root_config = read_terragrunt_config(find_in_parent_folders())
bootstrap_config = local.root_config.locals.bootstrap_config
}
terraform {
source = "./"
source = "${get_parent_terragrunt_dir()}/..//bootstrap/state"
}
inputs = {
bucket_name = local.bootstrap_config.state.bucket_name
region = local.bootstrap_config.region
bootstrap_config_path = abspath("${get_parent_terragrunt_dir()}/../config/accounts/bootstrap.yaml")
}

View File

@ -9,3 +9,9 @@ variable "region" {
type = string
default = null
}
variable "bootstrap_config_path" {
description = "Path to the bootstrap account configuration YAML"
type = string
default = "../../config/accounts/bootstrap.yaml"
}

View File

@ -1,6 +1,3 @@
terraform_version_constraint = ">= 1.2.0"
terragrunt_version_constraint = ">= 0.67.14"
locals {
bootstrap_config = yamldecode(file("${get_original_terragrunt_dir()}/../config/accounts/bootstrap.yaml"))
}