Data Resource: Read computed value from state

Regarding this issue, is there a way to read the existing value from the state file? My purpose is to read “lease_id” from state file, if the lease is still active continue without creating a new Vault credential.

Hi @hus,

Just a thought.
Could you do a tf plan -out #plan.tfplan# | tf show -json #out.json# and then use something like jq to search for “lease_id” in the #out.json#.

Thanks,

Thanks, I’m looking for a way to check the state value in the data source, using the Vault provider.

The state file will capture the data sources when used with a null resource.
Other than the option of parsing the state file for “lease_id”, the data source output could be looked into.

Thanks,