How to pass terraform outputs variables into ansible as vars_files?

前端 未结 4 1823
悲哀的现实
悲哀的现实 2020-12-31 21:18

I am provisioning AWS infrastructure using terraform and want to pass variables such as aws_subnet_id and aws_security_id into ansible playbook usi

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 22:25

    Use terraform outputs - https://www.terraform.io/intro/getting-started/outputs.html (it is not clear if you are using it already)

    Then using command like terraform output ip, you can then use those values in your scripts to generate or populate other files like inventory files or vars_file.

    Another option is to use terraform templates and render your files like inventory files from terraform itself and then use it from Ansible.

提交回复
热议问题