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

Validate all resources are mapped #186

Closed
corymhall opened this issue Oct 30, 2024 · 3 comments · Fixed by #231
Closed

Validate all resources are mapped #186

corymhall opened this issue Oct 30, 2024 · 3 comments · Fixed by #231
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@corymhall
Copy link
Contributor

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

In graph.ts we register resources by walking the tree.json file, finding any cfn resources, and then extracting the matching resource from the template. We should also do a final validation that all resources in the template are found in the tree.json file. It looks like in some cases resources with an id of Default do not show up in the tree.json file.

Affected area/feature

@corymhall corymhall added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team and removed needs-triage Needs attention from the triage team labels Oct 30, 2024
@cleverguy25
Copy link

Added to epic https://github.com/pulumi/home/issues/2191

@flostadler
Copy link
Contributor

flostadler commented Oct 30, 2024

Just found a case where a resource isn't mapped:

const bucket = new s3.Bucket(this, 'WebsiteBucket', {
            websiteIndexDocument: 'index.html',
            publicReadAccess: true,
            blockPublicAccess: {
                blockPublicAcls: false,
                blockPublicPolicy: false,
                ignorePublicAcls: false,
                restrictPublicBuckets: false,
            },
            autoDeleteObjects: true,
            removalPolicy: cdk.RemovalPolicy.DESTROY,
        });

In this case a custom resource is added to clean up the items in the bucket on delete. This currently fails with:

Error: missing reference for CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092
        at StackConverter.lookup (/Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:419:15)
        at StackConverter.resolveAtt (/Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:423:56)
        at StackConverter.resolveIntrinsic (/Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:306:29)
        at StackConverter.processIntrinsics (/Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:286:25)
        at /Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:291:65
        at Array.reduce (<anonymous>)
        at StackConverter.processIntrinsics (/Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:291:14)
        at /Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:291:65
        at Array.reduce (<anonymous>)
        at StackConverter.processIntrinsics (/Users/flo/development/pulumi-cdk/src/converters/app-converter.ts:291:14)

The reason for that is that the IAM role that's part of this construct isn't properly detected as a resource.

This is an excerpt of the tree.json showing the missing resources:

"Custom::S3AutoDeleteObjectsCustomResourceProvider": {
            "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider",
            "path": "s3deployment/Custom::S3AutoDeleteObjectsCustomResourceProvider",
            "children": {
              "Staging": {
                "id": "Staging",
                "path": "s3deployment/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging",
                "constructInfo": {
                  "fqn": "aws-cdk-lib.AssetStaging",
                  "version": "2.149.0"
                }
              },
              "Role": {
                "id": "Role",
                "path": "s3deployment/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role",
                "constructInfo": {
                  "fqn": "aws-cdk-lib.CfnResource",
                  "version": "2.149.0"
                }
              },
              "Handler": {
                "id": "Handler",
                "path": "s3deployment/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler",
                "constructInfo": {
                  "fqn": "aws-cdk-lib.CfnResource",
                  "version": "2.149.0"
                }
              }
            },
            "constructInfo": {
              "fqn": "aws-cdk-lib.CustomResourceProviderBase",
              "version": "2.149.0"
            }
          },

@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #231 and shipped in release v1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants