hashicorp / sentinel-sdk

This SDK allows developers to extend Sentinel to source external information for use in their policies.
Mozilla Public License 2.0
51 stars 13 forks source link

Access to Terraform Cloud Environment Variables #47

Closed ghost closed 4 years ago

ghost commented 4 years ago

Is there a function in sentinel to retrieve the environment variable?

When running on terraform cloud, it's able to get the use defined environment variables from import "tfrun".

Is there a way to access the run's environment variables specially TFC_RUN_ID and TFC_CONFIGURATION_VERSION_GIT_COMMIT_SHA ?

https://www.terraform.io/docs/cloud/run/run-environment.html

hcrhall commented 4 years ago

Hi @storebot,

Unfortunately, Sentinel is currently unable to evaluate environment variables that are injected into the Terraform worker.

I am interested in understanding how you would like to use the TFC variables with Sentinel. If you could provide more details about your use-case that would be great.

ghost commented 4 years ago

For integrating with existing infra, I would like the sentinel to call a rest endpoint passing a RUN_ID, and from the endpoint, one can easily data enrich using tfcloud APIs.

hcrhall commented 4 years ago

@storebot I'm really sorry for not getting back to you. I've spoken to a number of our field based engineers, and they too have expressed an interest in the attributes that you have mentioned. I have raised a feature request internally so that we can prioritize accordingly. I'll be closing this issue as we are tracking the request elsewhere.