bootstrap outputs
This commit is contained in:
parent
3eeccb836e
commit
ad247e9435
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
locals {
|
||||
_custom_roles = {
|
||||
custom_roles = {
|
||||
for k, v in var.custom_role_names :
|
||||
k => module.organization.custom_role_id[v]
|
||||
}
|
||||
|
@ -31,43 +31,6 @@ locals {
|
|||
sa = module.automation-tf-resman-sa.email
|
||||
})
|
||||
}
|
||||
tfvars = {
|
||||
"01-resman" = jsonencode({
|
||||
automation_project_id = module.automation-project.project_id
|
||||
billing_account = var.billing_account
|
||||
custom_roles = local._custom_roles
|
||||
groups = var.groups
|
||||
organization = var.organization
|
||||
prefix = var.prefix
|
||||
})
|
||||
"02-networking" = jsonencode({
|
||||
billing_account_id = var.billing_account.id
|
||||
custom_roles = local._custom_roles
|
||||
organization = var.organization
|
||||
prefix = var.prefix
|
||||
})
|
||||
"02-security" = jsonencode({
|
||||
billing_account_id = var.billing_account.id
|
||||
organization = var.organization
|
||||
prefix = var.prefix
|
||||
})
|
||||
"03-gke-multitenant-dev" = jsonencode({
|
||||
billing_account_id = var.billing_account.id
|
||||
prefix = var.prefix
|
||||
})
|
||||
"03-gke-multitenant-prod" = jsonencode({
|
||||
billing_account_id = var.billing_account.id
|
||||
prefix = var.prefix
|
||||
})
|
||||
"03-project-factory-dev" = jsonencode({
|
||||
billing_account_id = var.billing_account.id
|
||||
prefix = var.prefix
|
||||
})
|
||||
"03-project-factory-prod" = jsonencode({
|
||||
billing_account_id = var.billing_account.id
|
||||
prefix = var.prefix
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
# optionally generate providers and tfvars files for subsequent stages
|
||||
|
@ -79,9 +42,12 @@ resource "local_file" "providers" {
|
|||
}
|
||||
|
||||
resource "local_file" "tfvars" {
|
||||
for_each = var.outputs_location == null ? {} : local.tfvars
|
||||
filename = "${pathexpand(var.outputs_location)}/${each.key}/terraform-bootstrap.auto.tfvars.json"
|
||||
content = each.value
|
||||
for_each = var.outputs_location == null ? {} : { 1 = 1 }
|
||||
filename = "${pathexpand(var.outputs_location)}/tfvars/00-bootstrap.auto.tfvars.json"
|
||||
content = jsonencode({
|
||||
automation_project_id = module.automation-project.project_id
|
||||
custom_roles = local.custom_roles
|
||||
})
|
||||
}
|
||||
|
||||
# outputs
|
||||
|
@ -91,6 +57,11 @@ output "billing_dataset" {
|
|||
value = try(module.billing-export-dataset.0.id, null)
|
||||
}
|
||||
|
||||
output "custom_roles" {
|
||||
description = "Organization-level custom roles."
|
||||
value = local.custom_roles
|
||||
}
|
||||
|
||||
output "project_ids" {
|
||||
description = "Projects created by this stage."
|
||||
value = {
|
||||
|
@ -108,11 +79,3 @@ output "providers" {
|
|||
sensitive = true
|
||||
value = local.providers
|
||||
}
|
||||
|
||||
# ready to use variable values for subsequent stages
|
||||
|
||||
output "tfvars" {
|
||||
description = "Terraform variable files for the following stages."
|
||||
sensitive = true
|
||||
value = local.tfvars
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue