From 024854d7d5864b9c519f782aed6fea23d173f0d2 Mon Sep 17 00:00:00 2001 From: Peter Li Date: Thu, 31 Mar 2022 13:56:23 +0800 Subject: [PATCH] Fix Error reading tfstate file: 0.12 format Seems like we need to provide the path to the directory with the .tfstate file. Adding ./ does this. See https://github.com/adammck/terraform-inventory/issues/121 --- ops/infrastructure/inventories/terraform-inventory.sh | 2 +- ops/scripts/ansible_init.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ops/infrastructure/inventories/terraform-inventory.sh b/ops/infrastructure/inventories/terraform-inventory.sh index fc5b982e7d..eb7cf20800 100755 --- a/ops/infrastructure/inventories/terraform-inventory.sh +++ b/ops/infrastructure/inventories/terraform-inventory.sh @@ -3,4 +3,4 @@ # bash shell wrapper for terraform-inventory. # How to install the https://github.com/adammck/terraform-inventory command: # brew install terraform-inventory -terraform-inventory $@ +terraform-inventory $@ ./ diff --git a/ops/scripts/ansible_init.sh b/ops/scripts/ansible_init.sh index d0050e1a6a..c0516096c5 100755 --- a/ops/scripts/ansible_init.sh +++ b/ops/scripts/ansible_init.sh @@ -37,7 +37,7 @@ cp ../../dockerhost_playbook.yml . cp ../../bastion_playbook.yml . # Update Gitlab gigadb_db_host variable with RDS instance address from terraform-inventory -rds_inst_addr=$(../../inventories/terraform-inventory.sh --list | jq -r '.all.vars.rds_instance_address') +rds_inst_addr=$(../../inventories/terraform-inventory.sh --list ./ | jq -r '.all.vars.rds_instance_address') curl -s --request PUT --header "PRIVATE-TOKEN: $GITLAB_PRIVATE_TOKEN" "$PROJECT_VARIABLES_URL/gigadb_db_host?filter%5benvironment_scope%5d=$target_environment" --form "value=$rds_inst_addr" # Update properties file with values from GitLab so Ansible can configure the services