scottwinkler / terraform-provider-shell

Terraform provider for executing shell commands and saving output to state file
Mozilla Public License 2.0
279 stars 60 forks source link

Add support for inheriting environment variables #128

Closed stevehipwell closed 8 months ago

stevehipwell commented 8 months ago

I would like to be able to inherit environment variables from the execution environment so these can be dynamic between plan and apply.

My use case is that to authenticate with OIDC in a GitHub actions workflow the ID token needs to not have expired and if the shell resource is executing after that's happened I can't authenticate. If I can access the ACTIONS_ID_TOKEN_REQUEST_URL & ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variables I can generate a new ID token, but as these values are only valid within a single GitHub Actions step they can't be passed in to Terraform as a variable and then used in a different step.

stevehipwell commented 8 months ago

Ignore this, I was paying too much attention to the error output which only showed the env inputs. By running export I can see that the environment variables are all set.