diff --git a/infra/modules/azure_federated_identity_with_github/README.md b/infra/modules/azure_federated_identity_with_github/README.md index 62ccf0742..28ed4b261 100644 --- a/infra/modules/azure_federated_identity_with_github/README.md +++ b/infra/modules/azure_federated_identity_with_github/README.md @@ -31,8 +31,8 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [continuos\_delivery](#input\_continuos\_delivery) | Continuos Delivery identity properties, such as repositories to federated with and RBAC roles |
object({|
enable = bool
roles = object({
subscription = set(string)
resource_groups = map(list(string))
})
})
{| no | -| [continuos\_integration](#input\_continuos\_integration) | Continuos Integration identity properties, such as repositories to federated with and RBAC roles |
"enable": true,
"roles": {
"resource_groups": {
"terraform-state-rg": [
"Storage Blob Data Contributor"
]
},
"subscription": [
"Contributor"
]
}
}
object({|
enable = bool
roles = object({
subscription = set(string)
resource_groups = map(list(string))
})
})
{| no | +| [continuos\_delivery](#input\_continuos\_delivery) | Continuos Delivery identity properties, such as repositories to federated with and RBAC roles |
"enable": true,
"roles": {
"resource_groups": {
"terraform-state-rg": [
"Storage Blob Data Contributor"
]
},
"subscription": [
"Reader",
"Reader and Data Access",
"PagoPA IaC Reader",
"DocumentDB Account Contributor"
]
}
}
object({|
enable = bool
roles = optional(object({
subscription = set(string)
resource_groups = map(list(string))
}))
})
{| no | +| [continuos\_integration](#input\_continuos\_integration) | Continuos Integration identity properties, such as repositories to federated with and RBAC roles |
"enable": true,
"roles": {
"resource_groups": {
"terraform-state-rg": [
"Storage Blob Data Contributor"
]
},
"subscription": [
"Contributor"
]
}
}
object({|
enable = bool
roles = optional(object({
subscription = set(string)
resource_groups = map(list(string))
}))
})
{| no | | [domain](#input\_domain) | (Optional) Domain of the project | `string` | `""` | no | | [env](#input\_env) | Environment name | `string` | n/a | yes | | [env\_short](#input\_env\_short) | Environment short name | `string` | n/a | yes | diff --git a/infra/modules/azure_federated_identity_with_github/outputs.tf b/infra/modules/azure_federated_identity_with_github/outputs.tf index 4edce4957..7be25f93e 100644 --- a/infra/modules/azure_federated_identity_with_github/outputs.tf +++ b/infra/modules/azure_federated_identity_with_github/outputs.tf @@ -1,31 +1,25 @@ output "federated_ci_identity" { - value = { - id = module.federated_ci_identity[0].identity_principal_id - client_id = module.federated_ci_identity[0].identity_client_id - name = module.federated_ci_identity[0].identity_app_name - resource_group_name = module.federated_ci_identity[0].identity_resource_group - } - - precondition { - condition = var.continuos_integration.enable == true - error_message = "Continuos Integration is not enabled" - } + value = try( + { + id = module.federated_ci_identity[0].identity_principal_id + client_id = module.federated_ci_identity[0].identity_client_id + name = module.federated_ci_identity[0].identity_app_name + resource_group_name = module.federated_ci_identity[0].identity_resource_group + }, {} + ) description = "Data about the Continuos Integration managed identity created" } output "federated_cd_identity" { - value = { - id = module.federated_cd_identity[0].identity_principal_id - client_id = module.federated_cd_identity[0].identity_client_id - name = module.federated_cd_identity[0].identity_app_name - resource_group_name = module.federated_cd_identity[0].identity_resource_group - } - - precondition { - condition = var.continuos_delivery.enable == true - error_message = "Continuos Delivery is not enabled" - } + value = try( + { + id = module.federated_cd_identity[0].identity_principal_id + client_id = module.federated_cd_identity[0].identity_client_id + name = module.federated_cd_identity[0].identity_app_name + resource_group_name = module.federated_cd_identity[0].identity_resource_group + }, {} + ) description = "Data about the Continuos Delivery managed identity created" } diff --git a/infra/modules/azure_federated_identity_with_github/variables.tf b/infra/modules/azure_federated_identity_with_github/variables.tf index dfdcd9164..d629892d4 100644 --- a/infra/modules/azure_federated_identity_with_github/variables.tf +++ b/infra/modules/azure_federated_identity_with_github/variables.tf @@ -32,10 +32,10 @@ variable "repositories" { variable "continuos_integration" { type = object({ enable = bool - roles = object({ + roles = optional(object({ subscription = set(string) resource_groups = map(list(string)) - }) + })) }) default = { @@ -61,10 +61,10 @@ variable "continuos_integration" { variable "continuos_delivery" { type = object({ enable = bool - roles = object({ + roles = optional(object({ subscription = set(string) resource_groups = map(list(string)) - }) + })) }) default = {
"enable": true,
"roles": {
"resource_groups": {
"terraform-state-rg": [
"Storage Blob Data Contributor"
]
},
"subscription": [
"Reader",
"Reader and Data Access",
"PagoPA IaC Reader",
"DocumentDB Account Contributor"
]
}
}