diagram-as-code
diagram-as-code copied to clipboard
Target resource is not drawn when related to resources in the same layer
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
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.
[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html