How to fork step process and make new process running within the same enviroment? #26217
-
Hi, I’m running terraform from my Github Actions workflow. One of my Terraform resources uses a ‘post-create’ step to run a bash command.
So this invokes the following bash command
Please note that the command is initiated by Terraform process (job step) and not by the Github Action runner (from workflow yaml). It turns out that my command gets started within a completely different enviroment, perfectly ‘clean’. I don’t have access to previously installed Google SDK (gcloud). Though if run same command from my workflow yaml it works just fine.
Is there a way to run bash command from inside the Job Step process so that it runs within the same enviroment and have access to the same ‘resources’ as command started with run: … from workflow yaml ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Do you use this Terraform GitHub Actions? As this is a Docker Container action, if you run post-create bash command inside this step, it is executed on docker container not on the github actions runner machine. So when you run scripts in next steps, the environment will change, it will use runner machine environment , not the Terraform docker container. |
Beta Was this translation helpful? Give feedback.
-
Hi, Yes I use Terraform GitHub Actions. Hm … do you know if there is any alternative to Terraform GitHub Actions which is not a docker based? this is quite an annoying limitattion as having access to local-exec would be userful. Thank you for the reply! |
Beta Was this translation helpful? Give feedback.
-
Sorry to tell you that I don’t know an alternative to that docker container Terraform action. What’s the insufficient of running gcloud command from your workflow yaml ? |
Beta Was this translation helpful? Give feedback.
-
yeah that’s what I finally went for! Thank you. |
Beta Was this translation helpful? Give feedback.
Do you use this Terraform GitHub Actions? As this is a Docker Container action, if you run post-create bash command inside this step, it is executed on docker container not on the github actions runner machine. So when you run scripts in next steps, the environment will change, it will use runner machine environment , not the Terraform docker container.
If this doesn’t match your scenario, could you pleaseenable step debug logging and share your workflow yaml and workflow run logs here?