File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,8 +12,16 @@ locals {
1212 remote_state_backend_type = try (local. config . remote_state_backend_type , " " )
1313 backend_type = coalesce (local. remote_state_backend_type , local. config . backend_type )
1414
15- remote_state_backend = try (local. config . remote_state_backend , null ) != null ? local. config . remote_state_backend : null
16- backend = local. remote_state_backend != null ? local. remote_state_backend : local. config . backend
15+ # If `config.remote_state_backend` is not declared in YAML config, the default value will be an empty map `{}`
16+ backend_config_key = try (local. config . remote_state_backend , null ) != null && try (length (local. config . remote_state_backend ), 0 ) > 0 ? " remote_state_backend" : " backend"
17+
18+ # This is used because the `?` operator in some instances (depending on the condition) changes the types of all items of the map to all `strings`
19+ backend_configs = {
20+ backend = local.config.backend
21+ remote_state_backend = local.config.remote_state_backend
22+ }
23+
24+ backend = local. backend_configs [local . backend_config_key ]
1725
1826 workspace = local. config . workspace
1927 workspace_key_prefix = lookup (local. backend , " workspace_key_prefix" , null )
You can’t perform that action at this time.
0 commit comments