Removing a stack doesn’t remove the IoT Policies. ...
# help
d
Removing a stack doesn’t remove the IoT Policies. Therefore, we can’t recreate the stacks.
Copy code
const iotAuthPolicy = new iot.CfnPolicy(this, 'IotAuthPolicy', {
      policyName: 'iot-auth-policy',
      policyDocument: {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": "iot:*",
            "Resource": "*"
          }
        ]
      },
    });
This policy remains after we remove even when we define:
Copy code
if (app.stage !== "prod") {
    app.setDefaultRemovalPolicy(RemovalPolicy.DESTROY);
  }
Found it:
Copy code
new cloudfront.Distribution(this, "Distribution", {
      domainNames: [scope.customDomainName('xxx')],
      certificate:
        new acm.DnsValidatedCertificate(this, "Certificate", {
          domainName: scope.customDomainName('xxx'),
          hostedZone:
            route53.HostedZone.fromLookup(this, "HostedZone", {
              domainName: '<http://xxx.io|xxx.io>',
            }),
          region: "us-east-1",
        }),
      defaultBehavior: {
        origin: new cfOrigins.S3Origin(this.xxx.s3Bucket, {
          originPath: 'public',
        }),
        viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
      },
    });