Dan Van Brunt
10/13/2021, 3:42 PMStaticSite as it currently does not seem to allow us to setup an origin group with the one that is created as part of the construct.  Or am I missing something?Dan Van Brunt
10/13/2021, 3:45 PM<unresolved-lazy> to me at that point… not sure what to do with that?Frank
import * as origins from '@aws-cdk/aws-cloudfront-origins';
new sst.StaticSite(this, "MySite", {
  ...,
  cfDistribution: {
    additionalBehaviors: {
      origin: new origins.OriginGroup(...)
    }
  }
});Frank
Dan Van Brunt
10/13/2021, 4:25 PMDan Van Brunt
10/13/2021, 4:26 PMcfDistribution then I think that would work?Dan Van Brunt
10/13/2021, 4:28 PMDan Van Brunt
10/13/2021, 4:29 PMDan Van Brunt
10/13/2021, 4:29 PMFrank
return new cloudfront.Distribution(this, "Distribution", {
      // these values can be overwritten by cfDistributionProps
      defaultRootObject: indexPage,
      errorResponses,
      ...cfDistributionProps,
      // these values can NOT be overwritten by cfDistributionProps
      domainNames,
      certificate: this.acmCertificate,
      defaultBehavior: {
        origin: new cfOrigins.S3Origin(this.s3Bucket, {
          originPath: this.deployId,
        }),
        viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
        ...(cfDistributionProps.defaultBehavior || {}),
      },
    });Frank
deployId i think.Dan Van Brunt
10/13/2021, 4:30 PMDan Van Brunt
10/13/2021, 4:30 PMDan Van Brunt
10/13/2021, 4:30 PMDan Van Brunt
10/13/2021, 4:30 PMFrank
Frank
Dan Van Brunt
10/13/2021, 4:31 PMDan Van Brunt
10/13/2021, 4:32 PMDan Van Brunt
10/13/2021, 4:32 PMDan Van Brunt
10/13/2021, 4:36 PMIBucket into StaticSite…. just the bucket props Maybe its ok to just pass in the Arn as bucket.bucketArn?Dan Van Brunt
10/13/2021, 4:39 PM<unresolved-lazy> sections of the origins are? Since you are only creating one in static site…. I could just assume the first one is the primaryDan Van Brunt
10/13/2021, 4:40 PMcf.CfnDistribution after StaticSite has resolvedFrank
Frank
Dan Van Brunt
10/13/2021, 4:47 PM"origins": "<unresolved-lazy>",
  "originGroups": "<unresolved-lazy>",Frank
Stack.resolve(origins) and see what that gives u?Dan Van Brunt
10/13/2021, 6:13 PMFrank
Frank
const cfnDistribution = site.cfDistribution.node.defaultChild as cf.CfnDistribution;
    const stack = cdk.Stack.of(this);
    const config = stack.resolve(cfnDistribution.distributionConfig);
    console.log(config);
And it printed out
{
  enabled: true,
  origins: [
    {
      domainName: [Object],
      id: 'devplaygroundsiteFrontendDistributionOrigin17965B565',
      originPath: '/deploy-7deba22a90a2dd9b208d57d40f2bdbcf',
      s3OriginConfig: [Object]
    }
  ],
  defaultCacheBehavior: {
    pathPattern: '*',
    targetOriginId: 'devplaygroundsiteFrontendDistributionOrigin17965B565',
    cachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
    compress: true,
    viewerProtocolPolicy: 'redirect-to-https'
  },
  aliases: [],
  customErrorResponses: [
    {
      errorCode: 403,
      responseCode: 200,
      responsePagePath: '/index.html'
    },
    {
      errorCode: 404,
      responseCode: 200,
      responsePagePath: '/index.html'
    }
  ],
  defaultRootObject: 'index.html',
  httpVersion: 'http2',
  ipv6Enabled: true
}Dan Van Brunt
10/13/2021, 7:25 PMDan Van Brunt
12/01/2021, 4:48 PMstack.resolve() actually do? I mean, currently I need to add a custom header to one of the origins but I don’t know which until I use that resolve on the config so I can see. Is there any order of operations issues with using resolve  then modifying the cfDistribution after?