Skip to content

Commit

Permalink
Root outputs:
Browse files Browse the repository at this point in the history
Set all modules even when empty.
When set for yaml and passed to ansible, it will be seen as 'null'

Output from ansible when variable is unset - `test:`
```
TASK [Debug] *******************************************************************
ok: [localhost] => {
    "msg": null
}
```
  • Loading branch information
bryan-bar committed Sep 5, 2023
1 parent a14c9cc commit d078556
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions edbterraform/data/templates/aws/main.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,18 @@
'module_base': 'module.machine_',
},
'databases': {
'active': has_databases,
'regions': database_regions,
'module_base': "module.database_",
},
'aurora': {
'active': has_aurora,
'regions': aurora_regions,
'module_base': "module.aurora_",
},
'biganimal': {
'active': has_biganimal,
'regions': biganimal_regions,
'module_base': "module.biganimal_",
},
'kubernetes': {
'active': has_kubernetes,
'regions': kubernetes_regions,
'module_base': "module.kubernetes_",
}
Expand All @@ -69,7 +65,7 @@ locals {
# Module names set with jinja2 in edb-terraform
# Modules cannot be referenced dynamically.
modules = {
{% for type, attributes in boxes.items() if attributes["active"] %}
{% for type, attributes in boxes.items() %}
{{ type }} = flatten([
{% for region in attributes["regions"] -%}
{% set module = attributes["module_base"] ~ region | replace('-', '_') %}
Expand Down
6 changes: 1 addition & 5 deletions edbterraform/data/templates/azure/main.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,18 @@

{% set boxes = {
'machines': {
'active': has_machines,
'regions': machine_regions,
'module_base': 'module.machine_',
},
'databases': {
'active': has_databases,
'regions': database_regions,
'module_base': "module.database_",
},
'biganimal': {
'active': has_biganimal,
'regions': biganimal_regions,
'module_base': "module.biganimal_",
},
'kubernetes': {
'active': has_kubernetes,
'regions': kubernetes_regions,
'module_base': "module.kubernetes_",
}
Expand All @@ -63,7 +59,7 @@ locals {
# Module names set with jinja2 in edb-terraform
# Modules cannot be referenced dynamically.
modules = {
{% for type, attributes in boxes.items() if attributes["active"] %}
{% for type, attributes in boxes.items() %}
{{ type }} = flatten([
{% for region in attributes["regions"] -%}
{% set module = attributes["module_base"] ~ region | replace('-', '_') %}
Expand Down
7 changes: 1 addition & 6 deletions edbterraform/data/templates/gcloud/main.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,22 @@

{% set boxes = {
'machines': {
'active': has_machines,
'regions': machine_regions,
'module_base': 'module.machine_',
},
'databases': {
'active': has_databases,
'regions': database_regions,
'module_base': "module.database_",
},
'alloy': {
'active': has_alloy,
'regions': alloy_regions,
'module_base': "module.alloy_",
},
'biganimal': {
'active': has_biganimal,
'regions': biganimal_regions,
'module_base': "module.biganimal_",
},
'kubernetes': {
'active': has_kubernetes,
'regions': kubernetes_regions,
'module_base': "module.kubernetes_",
}
Expand All @@ -63,7 +58,7 @@ locals {
# Module names set with jinja2 in edb-terraform
# Modules cannot be referenced dynamically.
modules = {
{% for type, attributes in boxes.items() if attributes["active"] %}
{% for type, attributes in boxes.items() %}
{{ type }} = flatten([
{% for region in attributes["regions"] -%}
{% set module = attributes["module_base"] ~ region | replace('-', '_') %}
Expand Down

0 comments on commit d078556

Please sign in to comment.