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-cdk/aws-dlm): Policy type is not synthesized when using CfnLifecyclePolicy construct #27817

Closed
khushail opened this issue Nov 2, 2023 · 6 comments
Labels
@aws-cdk/aws-dlm Related to Amazon Data Lifecycle Manager bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@khushail
Copy link
Contributor

khushail commented Nov 2, 2023

Describe the bug

CX is using the construct CfnLifecyclePolicy with Policy_type with the given code snippet. After synth, the policy_type details are msising from the template.

Synthesized template -

Resources:
  lifecyclepolicy:
    Type: AWS::DLM::LifecyclePolicy
    Properties:
      Description: EC2 Backup Policy
      ExecutionRoleArn: arn:aws:iam::404890032397:role/AWSDataLifecycleManagerDefaultRole
      PolicyDetails:
        ResourceTypes:
          - INSTANCE
        Schedules:
          - CopyTags: true
            CreateRule:
              CronExpression: cron(0 2 * * ? *)
              Interval: 2
              IntervalUnit: HOURS
            Name: DailyBackup
            RetainRule:
              Count: 12
            TagsToAdd:
              - Key: Purpose
                Value: Backup
        TargetTags:
          - Key: altci
            Value: ServiceNowDiscovery
      State: ENABLED

Additionally Cx mentions that they observe life cycle manager PolicyType to "EBS snapshot policy", instead of "EBS-backed AMI policy".

Expected Behavior

Synthesized template should include the policy_type property.

Current Behavior

Property is missing from the template

Reproduction Steps

dlm.CfnLifecyclePolicy(
self,
id="lifecyclepolicy",
description="EC2 Backup Policy",
state='ENABLED',
execution_role_arn='',
policy_details={
'policy_type' : 'IMAGE_MANAGEMENT',
'resourceTypes': ['INSTANCE'],
'targetTags': [{
'key': 'altci',
'value': 'ServiceNowDiscovery'
}],
'schedules': [{
'name': 'DailyBackup',
'createRule': {
'interval': 2,
'intervalUnit': 'HOURS',
'cronExpression': 'cron(0 2 * * ? *)'
},
'retainRule': {
'count':12
},
'copyTags': True,
'tagsToAdd': [{'key': 'Purpose', 'value': 'Backup'}]

                }]
            }
        )

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.103.1

Framework Version

No response

Node.js Version

v18.15.0

OS

Mac

Language

Python

Language Version

No response

Other information

No response

@khushail khushail added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2023
@github-actions github-actions bot added the @aws-cdk/aws-dlm Related to Amazon Data Lifecycle Manager label Nov 2, 2023
@khushail khushail added p2 needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2023
@msambol
Copy link
Contributor

msambol commented Nov 3, 2023

@khushail I'll take this.

@msambol
Copy link
Contributor

msambol commented Nov 3, 2023

@khushail I was able to get this to deploy by changing policy_type to policyType.

@khushail
Copy link
Contributor Author

khushail commented Nov 6, 2023

Thanks @msambol , appreciate your efforts. Please feel free to submit the PR.

@khushail khushail removed the needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. label Nov 6, 2023
@msambol
Copy link
Contributor

msambol commented Nov 6, 2023

@khushail I don't think there needs to be one? policy_type was user input, correct?

@khushail
Copy link
Contributor Author

khushail commented Nov 6, 2023

Yes, that works. Thanks so much @msambol , for pointing this out. We would need to update the Python doc which are automatically generated, so I would be creating an issue for the documentation update and add the required label jsii.

@khushail khushail closed this as completed Nov 6, 2023
Copy link

github-actions bot commented Nov 6, 2023

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-dlm Related to Amazon Data Lifecycle Manager bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants