7ef4d9f3f5
Also fixes a bug where the workspace was created from the wrong directory. Change-Id: I28b54b9aa57a3f449254574956701ee663618e8b
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
- hosts: all
|
|
tasks:
|
|
- name: Create workspace
|
|
include_role:
|
|
name: terraform
|
|
vars:
|
|
zuul_work_dir: '{{ zuul.project.src_dir }}/test-playbooks/terraform'
|
|
terraform_command: plan
|
|
terraform_create_workspace: true
|
|
|
|
- name: Make sure workspace was created
|
|
command: "{{ terraform_executable }} workspace select -no-color {{ terraform_workspace }}"
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}/test-playbooks/terraform"
|
|
|
|
- name: Select default workspace
|
|
command: "{{ terraform_executable }} workspace select default"
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}/test-playbooks/terraform"
|
|
|
|
- name: Use created workspace
|
|
include_role:
|
|
name: terraform
|
|
vars:
|
|
terraform_command: apply
|
|
|
|
- name: Delete workspace
|
|
include_role:
|
|
name: terraform
|
|
vars:
|
|
zuul_work_dir: '{{ zuul.project.src_dir }}/test-playbooks/terraform'
|
|
terraform_command: destroy
|
|
terraform_purge_workspace: true
|
|
|
|
- name: Make sure workspace was removed
|
|
register: terraform_workspace_stat
|
|
failed_when: terraform_workspace_stat.rc == 0
|
|
command: "{{ terraform_executable }} workspace select -no-color {{ terraform_workspace }}"
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}/test-playbooks/terraform"
|