CFT Template error: unresolved condition dependency UseDBSnapshot in Fn::If
CFT Template error: unresolved condition dependency UseDBSnapshot in Fn::If
正在尝试为 RDS 创建一个可以处理这两种情况的 CFT
创建一个新的 RDS Aurora MySQL 集群和
使用现有数据库集群快照创建 RDS 集群
这是我试过的,
我已经提供了模板的以下条件部分
"UseDbSnapshot" : {
"Fn::Not" : [
{
"Fn::Equals":[
{"Ref": "DBSnapshotName"},
""
]
}
]
}
并在资源部分引用如下
"RDSCluster1": {
"Type": "AWS::RDS::DBCluster",
"Condition": "isResourceCreate",
"Properties": {
"Engine": "aurora",
"DBSubnetGroupName": {
"Ref": "DBSubnetGroup"
},
"DBClusterParameterGroupName": {
"Ref": "RDSDBClusterParameterGroup"
},
"DBSnapshotIdentifier" : {
"Fn::If" : [
"UseDBSnapshot",
{"Ref" : "DBSnapshotName"},
{"Ref" : "AWS::NoValue"}
]
},
"MasterUsername": {
"Ref": "DbUser"
},
"MasterUserPassword": {
"Ref": "MasterUserPassword"
},
"StorageEncrypted" : true,
"KmsKeyId" : {
"Ref": "KmsKeyId"
},
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"DBAccessSecurityGroup",
"GroupId"
]
}
],
"Port": "3306",
"BackupRetentionPeriod": "1"
},
"DeletionPolicy": "Snapshot"
}
满足“isResourceCreate”条件,但出现以下错误
模板错误:未解决的条件依赖 UseDBSnapshot in Fn::If
你能帮我一下吗?
网上查过linkhttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-sample-templates.html
并创建了这个 CFT。
如果您需要更多详细信息,请告诉我。
如果您从快照恢复数据库,您不能提供MasterUsername
和MasterUserPassword
。这些值将来自快照 inherited,因此您必须将它们设为 可选。
If you specify the SourceDBInstanceIdentifier or DBSnapshotIdentifier property, don't specify this property. The value is inherited from the source DB instance or snapshot.
正在尝试为 RDS 创建一个可以处理这两种情况的 CFT 创建一个新的 RDS Aurora MySQL 集群和 使用现有数据库集群快照创建 RDS 集群
这是我试过的,
我已经提供了模板的以下条件部分
"UseDbSnapshot" : {
"Fn::Not" : [
{
"Fn::Equals":[
{"Ref": "DBSnapshotName"},
""
]
}
]
}
并在资源部分引用如下
"RDSCluster1": {
"Type": "AWS::RDS::DBCluster",
"Condition": "isResourceCreate",
"Properties": {
"Engine": "aurora",
"DBSubnetGroupName": {
"Ref": "DBSubnetGroup"
},
"DBClusterParameterGroupName": {
"Ref": "RDSDBClusterParameterGroup"
},
"DBSnapshotIdentifier" : {
"Fn::If" : [
"UseDBSnapshot",
{"Ref" : "DBSnapshotName"},
{"Ref" : "AWS::NoValue"}
]
},
"MasterUsername": {
"Ref": "DbUser"
},
"MasterUserPassword": {
"Ref": "MasterUserPassword"
},
"StorageEncrypted" : true,
"KmsKeyId" : {
"Ref": "KmsKeyId"
},
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"DBAccessSecurityGroup",
"GroupId"
]
}
],
"Port": "3306",
"BackupRetentionPeriod": "1"
},
"DeletionPolicy": "Snapshot"
}
满足“isResourceCreate”条件,但出现以下错误
模板错误:未解决的条件依赖 UseDBSnapshot in Fn::If
你能帮我一下吗?
网上查过linkhttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-sample-templates.html 并创建了这个 CFT。
如果您需要更多详细信息,请告诉我。
如果您从快照恢复数据库,您不能提供MasterUsername
和MasterUserPassword
。这些值将来自快照 inherited,因此您必须将它们设为 可选。
If you specify the SourceDBInstanceIdentifier or DBSnapshotIdentifier property, don't specify this property. The value is inherited from the source DB instance or snapshot.