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

[cloudformation-include] Resource used in GetAtt not found when using single quotes in template #10177

Closed
fongie opened this issue Sep 4, 2020 · 1 comment · Fixed by #10197
Assignees
Labels
@aws-cdk/cloudformation-include Issues related to the "CFN include v.20" package bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1

Comments

@fongie
Copy link

fongie commented Sep 4, 2020

When the imported template uses single quotes like !GetAtt 'MYID.Arn' cdk synth fails with Resource used in GetAtt expression with logical ID: ''MYID' not found (note the double single quotes in the error message)

Reproduction Steps

In my case:

NATIP:
        DependsOn: VPCGatewayAttachment
        Type: 'AWS::EC2::EIP'
        Properties:
            Domain: vpc

NATGateway:
        Type: 'AWS::EC2::NatGateway'
        Properties:
            AllocationId: !GetAtt 'NATIP.AllocationId'
            SubnetId: !Ref Subnet1

What did you expect to happen?

I was trying to cdk synth having imported my (already working in and deployed) yaml template using this code in a new stack

    const templateFile = path.join(__dirname, '../templates/template.yml');
    const include = new CfnInclude(this, 'Template', {
      templateFile
    });

What actually happened?

Resource used in GetAtt expression with logical ID: ''NATIP' not found
Subprocess exited with error 1

Environment

  • CLI Version : 1.62.0 (build 8c2d7fc)
  • Framework Version: 1.62.0
  • Node.js Version: v14.3.0
  • OS : mac Mojave 10.14.6
  • Language (Version): Typescript ~4.0.2

Other

Judging from the error message it seems an extra ' is making its way into the resource name somehow.


This is 🐛 Bug Report

@fongie fongie added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 4, 2020
@github-actions github-actions bot added the @aws-cdk/cloudformation-include Issues related to the "CFN include v.20" package label Sep 4, 2020
@skinny85
Copy link
Contributor

skinny85 commented Sep 4, 2020

Thanks for opening the issue @fongie . Confirming I was able to reproduce it. I'll be working on a fix.

@skinny85 skinny85 added effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 4, 2020
skinny85 added a commit to skinny85/aws-cdk that referenced this issue Sep 5, 2020
We weren't recursively parsing the argument of the short-form Fn::GetAtt
if the arguments to it where given in the string form;
which meant, if they were quoted (which is legal in YAML),
we would add the quote to the logical ID of the resource,
which is obviously incorrect.

Fixes aws#10177
skinny85 added a commit to skinny85/aws-cdk that referenced this issue Sep 8, 2020
We weren't recursively parsing the argument of the short-form Fn::GetAtt
if the arguments to it where given in the string form;
which meant, if they were quoted (which is legal in YAML),
we would add the quote to the logical ID of the resource,
which is obviously incorrect.

Fixes aws#10177
@mergify mergify bot closed this as completed in #10197 Sep 8, 2020
mergify bot pushed a commit that referenced this issue Sep 8, 2020
…10197)

We weren't recursively parsing the argument of the short-form `Fn::GetAtt`
if the arguments to it where given in the string form;
which meant, if they were quoted (which is legal in YAML),
we would add the quote to the logical ID of the resource,
which is obviously incorrect.

Fixes #10177

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/cloudformation-include Issues related to the "CFN include v.20" package bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants