[Feature]: add add_token_to_env provider argument
What whould you like to see?
I think it would be helpful to add the token to the env var HCLOUD_TOKEN if not already present.
This would help when using external scripts (e.g. terraform_data resource with local provisioner) that require a Hetzner Cloud API Token.
My usecase: I am checking if a hcloud snapshot exists (using the hcloud_images data source), if not I am calling the hcloud-upload-image binary using a terraform_data resource. So it would be helpful to use the same token as the provider and therefor the token must/should be exported as HCLOUD_TOKEN.
See example add_address_to_env from terraform-provider-vault
This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.
Not stale.
I am not sure if this would work. As far as I understood, os.Setenv() can only modify the environment variables of the currently running process. As terraform spawns a new process for each provider (and restarts them quite often), even if we were to add the token to the environment it would not be visible to any other provider or to terraform itself.