Reputation: 2562
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:
.terraformrc
file in ~
with valuesHow can I add env variables to my configuration?
Upvotes: 1
Views: 1059
Reputation: 11921
You would need to check what the logical id of the variable is, it should be aws, but if you dont have the EXCLUDE_STACK_ID_FROM_LOGICAL_IDS
flag in your cdktf.json it might be suffixed. Then setting the value to this id should be sufficient. You can check for this id by inspecting the generated JSON after cdktf synth
ran
Upvotes: 0