aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.71k stars 3.93k forks source link

decdk: Can't apply Fn::GetAtt to raw CloudFormation #2005

Closed cohalz closed 4 years ago

cohalz commented 5 years ago

All parts using Fn::GetAtt will be empty resources by cdk 0.25.3.

here is a short code.

Resources:
  MyQueue:
    Type: "@aws-cdk/aws-sqs.Queue"
    Properties:
      fifo: true
  MyLogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName:
        Fn::GetAtt: MyQueue.Arn
$ npx cdk -a "npx decdk hello.yml" synth
Resources:
  MyQueueE6CA6235:
    Type: AWS::SQS::Queue
    Properties:
      FifoQueue: true
    Metadata:
      aws:cdk:path: hello/MyQueue/Resource
  MyLogGroup:
    Type: AWS::Logs::LogGroup
    Properties: {}
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Modules: aws-cdk=0.25.2,@aws-cdk/aws-cloudwatch=0.25.3,@aws-cdk/aws-iam=0.25.3,@aws-cdk/aws-kms=0.25.3,@aws-cdk/aws-s3-notifications=0.25.3,@aws-cdk/aws-sqs=0.25.3,@aws-cdk/cdk=0.25.3,@aws-cdk/cx-api=0.25.3,jsii-runtime=node.js/v10.15.2

In addition, Cloudformation of ECS created by CDK will also become an empty resource as well.

~/s/decdktest ❯❯❯ npx cdk -a "npx decdk my-sample-ecs.yml" synth >! my-sample-ecs-cdk.yml
The stack my-sample-ecs already includes a CDKMetadata resource
~/s/decdktest ❯❯❯ diff my-sample-ecs.yml my-sample-ecs-cdk.yml
9,12d8
<       SourceSecurityGroupId:
<         Fn::GetAtt:
<           - AlbSecurityGroup580F65A6
<           - GroupId
128,131d123
<       ExecutionRoleArn:
<         Fn::GetAtt:
<           - TaskDefExecutionRoleB4775C97
<           - Arn
137,140d128
<       TaskRoleArn:
<         Fn::GetAtt:
<           - TaskDefTaskRole1EDB4A67
<           - Arn
192,195d179
<             Resource:
<               Fn::GetAtt:
<                 - LogGroupF5B46931
<                 - Arn
232,235c216
<       SecurityGroups:
<         - Fn::GetAtt:
<             - AlbSecurityGroup580F65A6
<             - GroupId
---
>       SecurityGroups: []
260,263d240
<       GroupId:
<         Fn::GetAtt:
<           - AlbSecurityGroup580F65A6
<           - GroupId
311,314c288,289
<         - - Fn::GetAtt:
<               - Alb16C2F182
<               - DNSName
<           - /ui
\ No newline at end of file
---
>         - - /ui
>
cohalz commented 5 years ago

At least, I confirmed that these functions can pass correctly.

cohalz commented 5 years ago

@eladb What about this? Is it in progress?

eladb commented 5 years ago

It's a bug, but we haven't had a chance to look at this.

eladb commented 4 years ago

Stale