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

Target resource is not drawn when related to resources in the same layer #73

Open
a2ush opened this issue May 9, 2024 · 1 comment
Open
Labels
bug Unexpected behavior / Something isn't working cfn-template feature improvement Improve an exist feature or a behavior

Comments

@a2ush
Copy link
Member

a2ush commented May 9, 2024

Issue detail

Target resource is not drawn when related to resources in the same layer.

Reproduce process

Subnets are same layer in this template.
In this case, the ELB is a child resource of the two subnets, and then it is not rendered.

Yaml template

Resources:
  VPC1:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: !Ref VPCCIDR    
      EnableDnsSupport: true
      EnableDnsHostnames: true
  Subnet1:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref VPC1
      MapPublicIpOnLaunch: false
  Subnet2:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref VPC1
      MapPublicIpOnLaunch: false
  NLB: 
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties: 
      Scheme: "internal"
      Subnets: 
        - !Ref Subnet1    ## <------- here
        - !Ref Subnet2    ## <------- here
      Type: network

NLB

@a2ush a2ush added cfn-template feature improvement Improve an exist feature or a behavior labels May 9, 2024
@a2ush
Copy link
Member Author

a2ush commented May 9, 2024

workaround : comment out the subnets

Resources:
...
  NLB: 
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties: 
      Scheme: "internal"
      # Subnets: 
      #   - !Ref Subnet1
      #   - !Ref Subnet2

If you want to put the ELB icon into the VPC, you can describe it as the following;

Resources:
...
  NLB: 
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties: 
      Scheme: "internal"
      VpcId: !Ref VPC1

In CloudFormation, Resource type AWS::ElasticLoadBalancingV2::LoadBalancer does not have "VpcId" Property[1].
However, since awsdac just looks at dependencies based on !Ref or DependsOn, there is no problem in assigning non-existent properties to resources.

NLB3

[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html

@a2ush a2ush added the bug Unexpected behavior / Something isn't working label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior / Something isn't working cfn-template feature improvement Improve an exist feature or a behavior
Projects
None yet
Development

No branches or pull requests

1 participant