Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudFront Origin Access Identity ARN wrapped in AWS Principal part of the template #2703

Closed
ScOut3R opened this issue May 31, 2019 · 0 comments · Fixed by #2964 or MechanicalRock/tech-radar#14 · May be fixed by MechanicalRock/cdk-constructs#5, MechanicalRock/cdk-constructs#6 or MechanicalRock/cdk-constructs#7
Labels
bug This issue is a bug.

Comments

@ScOut3R
Copy link
Contributor

ScOut3R commented May 31, 2019

Describe the bug
Using .addAwsPrincipal and supplying arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${originAccessIdentity.cloudFrontOriginAccessIdentityId} as the argument causes a line wrap in the generated template. This issue does not happen when using the JSON format.

              AWS:
                Fn::Join:
                  - ""
                  - - "arn:aws:iam::cloudfront:user/CloudFront Origin Access
                      Identity "
                    - Ref: OriginAccessIdentity

To Reproduce

 const originAccessIdentity = new CfnCloudFrontOriginAccessIdentity(this, 'OriginAccessIdentity', {
      cloudFrontOriginAccessIdentityConfig: {
        comment: 'Access Identity'
      }
    });

    const bucket = new Bucket(this, 'SiteBucket', {
      encryption: BucketEncryption.S3Managed
    });

    bucket.addToResourcePolicy(new PolicyStatement()
      .addActions('s3:GetObject')
      .addResource(`${bucket.bucketArn}/*`)
      .addAwsPrincipal(`arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${originAccessIdentity.cloudFrontOriginAccessIdentityId}`)
    );

Expected behavior
I expect no line wrap to happen.

Version:

  • Linux
  • TypeScript
  • CDK Version 0.33
@ScOut3R ScOut3R added the bug This issue is a bug. label May 31, 2019
RomainMuller added a commit that referenced this issue Jun 20, 2019
Certain versions of YAML support long line folding, however the
CloudFormation YAML parser does not handle those. Disabling folding
when generating YAML so that we keep generating correct templates.

Fixes #2703
RomainMuller added a commit that referenced this issue Jun 20, 2019
Certain versions of YAML support long line folding, however the
CloudFormation YAML parser does not handle those. Disabling folding
when generating YAML so that we keep generating correct templates.

Fixes #2703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment