Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// created, it will be used. if not, use tokens for account and region but
// they do not need to be scoped, the only situation in which
// export/fn::importvalue would work if { Ref: "AWS::AccountId" } is the
// same for provider and consumer anyway.
const account = env.account || Aws.ACCOUNT_ID;
const region = env.region || Aws.REGION;
// this is the "aws://" env specification that will be written to the cloud assembly
// manifest. it will use "unknown-account" and "unknown-region" to indicate
// environment-agnosticness.
const envAccount = !Token.isUnresolved(account) ? account : cxapi.UNKNOWN_ACCOUNT;
const envRegion = !Token.isUnresolved(region) ? region : cxapi.UNKNOWN_REGION;
return {
account, region,
environment: EnvironmentUtils.format(envAccount, envRegion)
};
}