add update workspace path
This commit is contained in:
parent
fa52fdeed9
commit
12807ca973
@ -2,3 +2,4 @@
|
||||
plugin: cloud.terraform.terraform_provider
|
||||
project_path:
|
||||
- /home/vez/homelab/terraform/projects/terransible
|
||||
state_file: terraform.tfstate.d/lab/terraform.tfstate
|
||||
|
@ -1,2 +1,3 @@
|
||||
---
|
||||
terraform_ansible_inventory: /home/vez/homelab/ansible/inventories/terraform.yml
|
||||
terraform_vm_state: present
|
||||
|
@ -4,6 +4,7 @@
|
||||
cloud.terraform.terraform:
|
||||
project_path: "{{ terraform_vm_project_path }}"
|
||||
state: "{{ terraform_vm_state }}"
|
||||
workspace: "{{ terraform_vars_vm_env | default(omit)}}"
|
||||
parallelism: 3
|
||||
complex_vars: true
|
||||
variables:
|
||||
@ -12,7 +13,13 @@
|
||||
vm_attr: "{{ terraform_vars_vm_attr | default(omit)}}"
|
||||
vm_env: "{{ terraform_vars_vm_env | default(omit)}}"
|
||||
vm_tags: "{{ terraform_vars_vm_tags | default(omit)}}"
|
||||
retries: 1
|
||||
|
||||
- name: Update Terraform workspace path
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ terraform_ansible_inventory }}"
|
||||
regexp: '^state_file:.*tfstate$'
|
||||
line: "state_file: terraform.tfstate.d/{{ terraform_vars_vm_env }}/terraform.tfstate"
|
||||
when: terraform_vars_vm_env is defined
|
||||
|
||||
- name: Refresh inventory
|
||||
ansible.builtin.meta: refresh_inventory
|
Loading…
x
Reference in New Issue
Block a user