I have the following code:
class MyStack extends TerraformStack {
constructor(scope: Construct, id: string) {
super(scope, id);
const awsSecrectKey = new TerraformVariable(this, "aws", {
type: "string",
sensitive: true,
});
new AwsProvider(this, "AWS", {
secretKey: awsSecrectKey.value
});
}
}
I want to read the variable aws from any configuration file. I tried the following:
- export aws="test"
- export aws="TF_VAR_aws"
- Created
.terraformrc
file in~
with values - Used dotenv to add TF_VAR_aws to process.env
How can I add env variables to my configuration?