Page MenuHomeSoftware Heritage

proxmox/terraform: Avoid variables duplication
ClosedPublic

Authored by ardumont on Aug 2 2019, 10:43 PM.

Details

Summary

Sole pattern found to avoid duplication.

This defines once the variables (configuration) needed both in the main definition and in the
module. When calling the module, we then pass along that configuration to the module call [1]

[1] https://www.terraform.io/docs/configuration-0-11/locals.html

Depends on D1808

Test Plan
terraform init
terraform plan
terraform apply

output (Nothing has changed \m/)

$ terraform apply
proxmox_vm_qemu.gateway: Refreshing state... (ID: orsay/qemu/109)
proxmox_vm_qemu.node: Refreshing state... (ID: orsay/qemu/115)
proxmox_vm_qemu.node: Refreshing state... (ID: orsay/qemu/114)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

db0_summary =
hostname: db0
fqdn: db0.internal.staging.swh.network
network: ip=192.168.128.3/24,gw=192.168.128.1 macaddr=3A:65:31:7C:24:17

storage0_summary =
hostname: storage0
fqdn: storage0.internal.staging.swh.network
network: ip=192.168.128.2/24,gw=192.168.128.1 macaddr=CA:73:7F:ED:F9:01

Diff Detail

Repository
rSPRE sysadm-provisioning
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 7132
Build 10055: arc lint + arc unit