sassoftware / viya4-iac-azure

This project contains Terraform configuration files to provision infrastructure components required to deploy SAS Viya platform products on Microsoft Azure Cloud.
Apache License 2.0
72 stars 88 forks source link

tfstate file bytes not flushed to nfs mounted directory #27

Closed ZackHelms closed 3 years ago

ZackHelms commented 3 years ago

When attempting to create k8s cluster resources in azure using DOCKER approach I see tfstate get created by nfsnobody, but it remains a 0 byte file. If I ask it to write out tfstate to a "local filesystem directory" like /tmp/mydir/, it succeeds; so I have a workaround. I'm opening this issue because customers will run into this and either:

  1. at the least our install doc should advise the install person to put tfstate in a non-nfs dir
  2. the docker-dope container could write out tfstate to a local tmpdir in /tmp (or some confirmed local mount) and when done copy it to the dir the user specified. Each deployment IaC script that modifies the tfstate would need to implement this internal workaround.

----- details

cd /r/ge.unx.sas.com/vol/vol620/u62/zahelm/gitrepos/epd-deployment-automation/deploydir-azure-zahelm-01

df -PH . Filesystem Size Used Avail Use% Mounted on ge.unx.sas.com:/vol/vol620 3.0T 2.3T 659G 78% /r/ge.unx.sas.com/vol/vol620

export DOPEVERSION=0.3.0 export THISDIR=/r/ge.unx.sas.com/vol/vol620/u62/zahelm/gitrepos/epd-deployment-automation/deploydir-azure-zahelm-01 docker run \ -e TF_VAR_subscription_id="$SUB_ID" \ -e TF_VAR_tenant_id="$TENANT_ID" \ -e TF_VAR_client_id="$SP_APPID" \ -e TF_VAR_client_secret="$SP_PASSWD" \ -e ARM_SUBSCRIPTION_ID="$SUB_ID" \ -e ARM_TENANT_ID="$TENANT_ID" \ -e ARM_CLIENT_ID="$SP_APPID" \ -e ARM_CLIENT_SECRET="$SP_PASSWD" \ -v $THISDIR:/data \ docker-dope.cyber.sas.com/viya4-iac-azure:$DOPEVERSION \ apply \ -auto-approve \ -var-file /data/terraform.tfvars \ -state /data/terraform.tfstate

while that docker run is running I see the following tfstate files in $THISDIR

-rw-r--r-- 1 nfsnobody nfsnobody 0 Nov 3 12:04 terraform.tfstate -rw------- 1 nfsnobody nfsnobody 209 Nov 3 12:00 .terraform.tfstate.lock.info

after that docker container is done running, I see 0 bytes written to tfstate:

-rw-r--r-- 1 nfsnobody nfsnobody 0 Nov 3 12:04 terraform.tfstate

NormJohnIV commented 3 years ago

Closing as we have long since added support and docs on running the container os the host user.