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

Lakeformation: CDK is re-creating resources when they are not changed #26834

Closed
denys-tyshetskyy opened this issue Aug 22, 2023 · 4 comments
Closed
Labels
@aws-cdk/aws-lakeformation Related to AWS Lake Formation @aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. p2

Comments

@denys-tyshetskyy
Copy link

denys-tyshetskyy commented Aug 22, 2023

Describe the bug

CDK is trying to create a new ResourceProperty in the lakeformation, every time the stack is being deployed even when no changes were made. For some resources like DataLocationResourceProperty, it breaks the deployment since provided resource already exists.

Expected Behavior

When nothing changes, the resource shouldn't be attempted to be deployed.

Current Behavior

I am provisioning the lake formation stack as a part of the project and every time deployment happens, even with no changes to lake formation stack whatsoever (other stacks are updated) the resources are being re-created in the lake formation stack.
This breaks the deployment because when DataLocationResourceProperty is attempted to be re-created the stack fails with the error Resource is already registered (Service: AWSLakeFormation; Status Code: 400; Error Code: AlreadyExistsException;

Reproduction Steps

         for bucket in buckets:
            bucket_resource: s3.Bucket = buckets.get(bucket)
            resource_property = lakeformation.CfnPermissions.ResourceProperty(
                data_location_resource=lakeformation.CfnPermissions.DataLocationResourceProperty(
                    s3_resource=bucket_resource.bucket_arn)
            )
            # Register S3 buckets as LF resources
            data_lake_resource = lakeformation.CfnResource(self, f"{bucket_resource}-LFResource",
                                                           resource_arn=bucket_resource.bucket_arn,
                                                           use_service_linked_role=False,
                                                           role_arn=role.role_arn
                                                           )
            lakeformation.CfnPermissions(self, f"{bucket_resource}-GlueDataLocationPermission",
                                         data_lake_principal=glue_principal,
                                         resource=resource_property,
                                         permissions=['DATA_LOCATION_ACCESS']
                                         ).add_dependency(data_lake_resource)

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.92.0

Framework Version

No response

Node.js Version

v16.20.1

OS

AWS Linux

Language

Python

Language Version

Python 3.10

Other information

No response

@denys-tyshetskyy denys-tyshetskyy added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 22, 2023
@github-actions github-actions bot added the @aws-cdk/aws-s3 Related to Amazon S3 label Aug 22, 2023
@denys-tyshetskyy denys-tyshetskyy changed the title (module name): (short issue description) Lakeformation: CDK is re-creating resources when they are not changed Aug 22, 2023
@github-actions github-actions bot added the @aws-cdk/aws-lakeformation Related to AWS Lake Formation label Aug 22, 2023
@pahud
Copy link
Contributor

pahud commented Aug 22, 2023

What did you see when you run cdk diff or npx cdk diff ?

If you run cdk diff without any code changes, there should be nothing changed.

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 22, 2023
@peterwoodworth
Copy link
Contributor

Yes, if there is a diff appearing then that means there is something in your code that is triggering CDK to add more to your template, which could be a bug on your end that we don't have the details on.

If there is no diff appearing, then CloudFormation should not be taking any action. If this does turn out to be the case, we will need to reach out to the service team

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Aug 22, 2023
@denys-tyshetskyy
Copy link
Author

denys-tyshetskyy commented Aug 23, 2023 via email

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 23, 2023
@scanlonp scanlonp closed this as completed Nov 9, 2023
Copy link

github-actions bot commented Nov 9, 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-lakeformation Related to AWS Lake Formation @aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. p2
Projects
None yet
Development

No branches or pull requests

4 participants