Closed dhx-mike-palandra closed 4 months ago
$ rain --version Rain v1.8.1 linux/amd64
Consider the following template:
Parameters: BackupPlanId: Type: String Resources: BackupSelection: Type: AWS::Backup::BackupSelection Properties: BackupPlanId: !Ref BackupPlanId BackupSelection: IamRoleArn: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/service-role/AWSBackupDefaultServiceRole Resources: - !Sub arn:${AWS::Partition}:elasticfilesystem:${AWS::Region}:${AWS::AccountId}:file-system/${EfsFileSystem} SelectionName: !Sub ${AWS::StackName} EfsFileSystem: Type: AWS::EFS::FileSystem
rain tree outputs the following:
rain tree
Resources: BackupSelection: DependsOn: Parameters: - AWS::Partition - AWS::StackName - BackupPlanId
Notice that the following dependencies are missing:
AWS::AccountId
Resources.BackupSelection.Properties.BackupSelection.IamRoleArn
EfsFileSystem
Resources.BackupSelection.Properties.BackupSelection.Resources[0]
If Resources.BackupSelection.Properties.BackupSelection.Resources[0] is changed to !Sub ${EfsFileSystem.Arn}, the resource dependency is found:
!Sub ${EfsFileSystem.Arn}
Resources: BackupSelection: DependsOn: Parameters: - AWS::Partition - AWS::StackName - BackupPlanId Resources: - EfsFileSystem
Looks like it misses a dependency on AWS::Region too.
AWS::Region
I have a feeling that the current code does not look past the first interpolation in a Fn::Sub string.
Fn::Sub
Consider the following template:
rain tree
outputs the following:Notice that the following dependencies are missing:
AWS::AccountId
(referenced inResources.BackupSelection.Properties.BackupSelection.IamRoleArn
)EfsFileSystem
(referenced in propertyResources.BackupSelection.Properties.BackupSelection.Resources[0]
)If
Resources.BackupSelection.Properties.BackupSelection.Resources[0]
is changed to!Sub ${EfsFileSystem.Arn}
, the resource dependency is found: