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

(aws-dms): Tags.of(CfnReplicationConfig construct).add({...}) does not work #28862

Closed
gossandr opened this issue Jan 25, 2024 · 5 comments · Fixed by #28989
Closed

(aws-dms): Tags.of(CfnReplicationConfig construct).add({...}) does not work #28862

gossandr opened this issue Jan 25, 2024 · 5 comments · Fixed by #28989
Assignees
Labels
@aws-cdk/aws-dms Related to AWS Database Migration Service (AWS DMS) bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@gossandr
Copy link
Contributor

gossandr commented Jan 25, 2024

Describe the bug

When attempting to add Tags to the CfnReplicationConfig construct, no tags are actually added.

Furthermore, removing the Tags.of() and re-deploying the stack results in an error (presumably from the DMS API?).

Tags.of() does work for other constructs in aws-dms. For example, for the CfnEndpoint construct Tags.of() works as expected.

Expected Behavior

I would expect the tags to be added to the resource.

I would expect after removing Tags.of from the resource construct that I would not get any deployment errors.

Current Behavior

after adding Tags.of() and deploying, no tags are deployed on the replication config resource.

after then removing the Tags.of() and re-deploying, the deploy fails with this error, perhaps related to the dms API itself.

Resource handler returned message: "No modifications requested for replication
config with arn, 'arn:aws:dms:eu-west-1:259363291751:replication-config:RTQ7JQX
ZPNBOBJFNHAVMWAJXLWS35IWZOID6VAI' (Service: DatabaseMigration, Status Code: 400
, Request ID: 2248b0dc-8583-4b56-8f20-5381c630c8f0)" (RequestToken: c316768f-94
3b-0a97-d2ed-550977a3729d, HandlerErrorCode: GeneralServiceException)

Reproduction Steps

export class DmsReplication extends Construct {

  constructor(scope: Construct, id: string, props: DmsReplicationProps) {
    super(scope, id);

    const replication = new CfnReplicationConfig(this, 'rc01', {

      replicationType: 'full-load',


      sourceEndpointArn: 'arn:of:source:endpoint',
      targetEndpointArn: 'arn:of:target:endpoint',

    });
    
    
    Tags.of(replication).add('test', 'value');
  }

Possible Solution

I suspect that this is related to the relative new-ness of the serverless replication support in cloudformation. But I have honestly no idea. 😅

Additional Information/Context

No response

CDK CLI Version

2.123.0 (build a594112)

Framework Version

No response

Node.js Version

v18.2.0

OS

macos Ventura 13.6.3 (22G436)

Language

TypeScript

Language Version

TypeScript 5.2.2

Other information

No response

@gossandr gossandr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 25, 2024
@github-actions github-actions bot added the @aws-cdk/aws-dms Related to AWS Database Migration Service (AWS DMS) label Jan 25, 2024
@pahud
Copy link
Contributor

pahud commented Jan 29, 2024

I think the tags of CfnReplicationConfig is probably mis-typed. It should be tags?: cdk.TagManager; instead.

    /**
     * One or more optional tags associated with resources used by the AWS DMS Serverless replication.
     */
    tags?: Array<cdk.CfnTag>;

@pahud pahud added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 29, 2024
@gossandr
Copy link
Contributor Author

@pahud my understanding with the L1 Construct that they are essentially generated from the cloudformation spec. So in the code you show above -- where did you find that? 😅

I noticed in the cloudformation spec a slight difference in how Tags is defined between the AWS::DMS::Endpoint type and the AWS::DMS::ReplicationConfig type.

The ReplicationConfig Tags definition looks like this:

        "Tags": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationconfig.html#cfn-dms-replicationconfig-tags",
          "UpdateType": "Mutable",
          "Required": false,
          "Type": "List",
          "ItemType": "Tag",
          "DuplicatesAllowed": true
    }

while the AWS::DMS::Endpoint looks like this:

        "Tags": {
          "Type": "List",
          "Required": false,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-tags",
          "ItemType": "Tag",
          "UpdateType": "Mutable"
        },

Not sure if this is relevant, but it is as far as I was able to get to understanding why this is happening

@GavinZZ
Copy link
Contributor

GavinZZ commented Feb 5, 2024

After investigation, the above schema mentioned above are both valid since tags formatted like [ { Key: 'MyTag', Value: 'MyValue' } ] and tags formatted like { MyTag: MyValue } are both valid. It seems that we accidentally forced the flag HAS_25610 to be false.

This results in that ITaggableV2 interfaces not getting implemented for CFN resource of modern styled tagging property, which resulted in Tags.of ... not working. I'm going to push a simple fix to this issue and should not cause any breaking change at all.

@mergify mergify bot closed this as completed in #28989 Feb 23, 2024
mergify bot pushed a commit that referenced this issue Feb 23, 2024
…28989)

### Issue # (if applicable)

Closes #28862

### Reason for this change

CFN resources that has array format `tags` cannot use `Tags.of()` to add tags.

### Description of changes

Enable modern style tags `ITaggableV2`

### Description of how you validated changes

The generated looks correct and shouldn't cause breaking changes.

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@gossandr
Copy link
Contributor Author

Thanks @GavinZZ and CDK team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-dms Related to AWS Database Migration Service (AWS DMS) bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants