Skip to content

Commit 17ad280

Browse files
committed
fix(credentials): support fallback to yaml
1 parent edf9e47 commit 17ad280

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

modules/credentials/main.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ locals {
6363

6464
available_env_cred_keys = toset(nonsensitive(keys(var.environment_credentials)))
6565

66-
# credential_type: env var takes precedence; falls back to cred_data for profile credentials
67-
# that declare credential_type in the YAML credential: block rather than the env var.
66+
# credential_type: env var takes precedence when explicitly set; falls back to cred_data from YAML.
67+
# Entries in environment_credentials that omit credential_type do not clobber the YAML value.
6868
env_cred_types = nonsensitive(merge(
6969
{ for k, item in local.all_credential_owners_map : k => try(item.cred_data.credential_type, "") },
70-
{ for k, v in var.environment_credentials : k => try(v.credential_type, "") }
70+
{ for k, v in var.environment_credentials : k => v.credential_type
71+
if try(v.credential_type, "") != "" }
7172
))
7273

73-
# auth_type: env var takes precedence; falls back to cred_data for profile credentials.
74+
# auth_type: env var takes precedence when explicitly set; falls back to cred_data from YAML.
75+
# Entries in environment_credentials that omit auth_type do not clobber the YAML value.
7476
env_cred_auth_types = nonsensitive(merge(
7577
{ for k, item in local.all_credential_owners_map : k => try(item.cred_data.auth_type, "password") },
76-
{ for k, v in var.environment_credentials : k => try(v.auth_type, "password") }
78+
{ for k, v in var.environment_credentials : k => v.auth_type
79+
if try(v.auth_type, "") != "" }
7780
))
7881

7982
# Fabric/Synapse: service principal auth uses tenant_id

0 commit comments

Comments
 (0)