constructor()

in src/constructs/core/stack.ts [117:154]


  constructor(scope: App, id: string, props: GuStackProps) {
    const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, app, withoutTags } = props;

    super(scope, id, {
      ...props,
      stackName: cloudFormationStackName,

      // TODO Use `DefaultStackSynthesizer` or create own synthesizer?
      //  see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth
      synthesizer: new LegacyStackSynthesizer(),
    });

    this.stack = stack;
    this.stage = stage.toUpperCase();
    this.app = app;
    this.repositoryName = this.tryGetRepositoryTag();

    if (!withoutTags) {
      this.addTag(TrackingTag.Key, TrackingTag.Value);

      this.addTag("Stack", this.stack);
      this.addTag("Stage", this.stage);
      if (this.app) {
        this.addTag("App", this.app);
      }

      if (this.repositoryName) {
        this.addTag(MetadataKeys.REPOSITORY_NAME, this.repositoryName);
      }
    }

    if (!props.withoutMetadata) {
      Aspects.of(this).add(new Metadata(this));
    }

    Aspects.of(this).add(new CfnIncludeReporter());
    Aspects.of(this).add(new CfnParameterReporter());
  }