Reputation: 32346
This works as expected. But as soon as I change the % in "schema-name" parameter to a reference, it fails.
DMSTaskMigration:
Type: 'AWS::DMS::ReplicationTask'
Properties:
ReplicationInstanceArn: !Ref DMSReplicationInstance
SourceEndpointArn: !Ref DMSSourceEndpoint
TargetEndpointArn: !Ref DMSTargetEndpoint
MigrationType: full-load
TableMappings: >-
{"rules": [{"rule-type": "selection", "rule-id": "1", "rule-action":
"include", "object-locator": {"schema-name": "%", "table-name": "%"},
"rule-name": "1"}]}
Tags:
-
Key: myString
Value: someString
The user should provide the value of schema name. I guess I should use !sub but not sure about the syntax. The following code does not work.
DMSTaskMigration:
Type: 'AWS::DMS::ReplicationTask'
Properties:
ReplicationInstanceArn: !Ref DMSReplicationInstance
SourceEndpointArn: !Ref DMSSourceEndpoint
TargetEndpointArn: !Ref DMSTargetEndpoint
MigrationType: full-load
TableMappings: >-
{"rules": [{"rule-type": "selection", "rule-id": "1", "rule-action":
"include", "object-locator": {"schema-name": !Ref MySql5Database, "table-name": "%"},
"rule-name": "1"}]}
Tags:
-
Key: myString
Value: someString
Upvotes: 1
Views: 78
Reputation: 238339
To use Sub
, you could do the following:
DMSTaskMigration:
Type: 'AWS::DMS::ReplicationTask'
Properties:
ReplicationInstanceArn: !Ref DMSReplicationInstance
SourceEndpointArn: !Ref DMSSourceEndpoint
TargetEndpointArn: !Ref DMSTargetEndpoint
MigrationType: full-load
TableMappings: !Sub >-
{"rules": [{"rule-type": "selection", "rule-id": "1", "rule-action":
"include", "object-locator": {"schema-name": "${MySql5Database}", "table-name": "%"},
"rule-name": "1"}]}
Tags:
-
Key: myString
Value: someString
Upvotes: 1