Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Cache the new context to disk
await this.props.configuration.saveContext();
// Execute again
continue;
}
}
if (trackVersions && assembly.runtime) {
const modules = formatModules(assembly.runtime);
for (const stack of assembly.stacks) {
if (!stack.template.Resources) {
stack.template.Resources = {};
}
const resourcePresent = stack.environment.region === cxapi.UNKNOWN_REGION
|| RegionInfo.get(stack.environment.region).cdkMetadataResourceAvailable;
if (resourcePresent) {
if (!stack.template.Resources.CDKMetadata) {
stack.template.Resources.CDKMetadata = {
Type: 'AWS::CDK::Metadata',
Properties: {
Modules: modules
}
};
if (stack.environment.region === cxapi.UNKNOWN_REGION) {
stack.template.Conditions = stack.template.Conditions || {};
const condName = 'CDKMetadataAvailable';
if (!stack.template.Conditions[condName]) {
stack.template.Conditions[condName] = _makeCdkMetadataAvailableCondition();
stack.template.Resources.CDKMetadata.Condition = condName;
} else {
warning(`The stack ${stack.id} already includes a ${condName} condition`);
public resolve(ctx: cdk.IResolveContext) {
const region = this.opts.region || cdk.Stack.of(ctx.scope).region;
const fact = RegionInfo.get(region).servicePrincipal(this.service);
return fact || Default.servicePrincipal(this.service, region, cdk.Aws.URL_SUFFIX);
}
public bind(_record: route53.IRecordSet): route53.AliasRecordTargetConfig {
const {region} = Stack.of(this.bucket.stack);
if (Token.isUnresolved(region)) {
throw new Error([
'Cannot use an S3 record alias in region-agnostic stacks.',
'You must specify a specific region when you define the stack',
'(see https://docs.aws.amazon.com/cdk/latest/guide/environments.html)'
].join(' '));
}
const {s3StaticWebsiteHostedZoneId: hostedZoneId, s3StaticWebsiteEndpoint: dnsName} = RegionInfo.get(region);
if (!hostedZoneId || !dnsName) {
throw new Error(`Bucket website target is not supported for the "${region}" region`);
}
return {hostedZoneId, dnsName};
}
}