Add dynamic ansible inventory from terraform state

This commit is contained in:
Tobias Reisinger 2025-08-10 14:58:54 +02:00
parent bccc07f806
commit 70578f2a13
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
11 changed files with 84 additions and 51 deletions

View file

@ -102,9 +102,9 @@ if __name__ == '__main__':
services = {}
with open('./hosts.auto.tfvars', 'r') as file:
hosts = hcl2.load(file)["hosts"][0]
hosts = hcl2.load(file)["hosts"]
with open('./services.auto.tfvars', 'r') as file:
services = hcl2.load(file)["services"][0]
services = hcl2.load(file)["services"]
keys = {}
keys["db_key"] = service_key_find("postgresql", services, hosts)