diff --git a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts index c5bcd30333362..2dd0c8da5bc6b 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts @@ -64,6 +64,7 @@ export class DatabaseQuery extends Construct implements iam.IGrant const provider = new customresources.Provider(this, 'Provider', { onEventHandler: handler, + role: this.getProviderRole(handler), }); const queryHandlerProps: DatabaseQueryHandlerProps & HandlerProps = { @@ -116,4 +117,20 @@ export class DatabaseQuery extends Construct implements iam.IGrant } return adminUser; } + + /** + * Get or create the IAM role for the singleton lambda function. + * We only need one function since it's just acting as a trigger. + * */ + private getProviderRole(handler: lambda.SingletonFunction): iam.IRole { + const id = handler.constructName + 'ProviderRole'; + const existing = cdk.Stack.of(this).node.tryFindChild(id); + + return existing != null + ? existing as iam.Role + : new iam.Role(this, id, { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), + managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaBasicExecutionRole')], + }); + } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.assets.json index bfe0abb5bae9c..cdc2dde254587 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.assets.json @@ -27,7 +27,7 @@ } } }, - "654dac42f13b13875196142a61b0a246e6e649087142501c45c311291b0204d3": { + "b5e28c78e7f56fa21b428ffb431725d50cb22d29d89c5ef65a847a168d1e0a83": { "source": { "path": "aws-cdk-redshift-distkey-create.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "654dac42f13b13875196142a61b0a246e6e649087142501c45c311291b0204d3.json", + "objectKey": "b5e28c78e7f56fa21b428ffb431725d50cb22d29d89c5ef65a847a168d1e0a83.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.template.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.template.json index ff22bf37d5766..8a28c39d11a47 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.template.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-create.template.json @@ -604,7 +604,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleC3128F67": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -637,7 +637,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -671,10 +671,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "PolicyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", "Roles": [ { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ] }, @@ -704,7 +704,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, @@ -720,8 +720,8 @@ "Timeout": 900 }, "DependsOn": [ - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "TableProviderframeworkonEventServiceRoleC3128F67" + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.assets.json index 7234ed84cdd70..ed10132446eb5 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.assets.json @@ -27,7 +27,7 @@ } } }, - "56d804c108ae167e92882443750bef6c2685937df49eec3dc5846e9bd8312330": { + "3f9f6343a4ca2c56d0d40f3b727131539c54bb65d8b7b6fdc0d81069d238b211": { "source": { "path": "aws-cdk-redshift-distkey-update.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "56d804c108ae167e92882443750bef6c2685937df49eec3dc5846e9bd8312330.json", + "objectKey": "3f9f6343a4ca2c56d0d40f3b727131539c54bb65d8b7b6fdc0d81069d238b211.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.template.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.template.json index f4fc9d39b132d..f47e78b4a2ea9 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.template.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/aws-cdk-redshift-distkey-update.template.json @@ -604,7 +604,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleC3128F67": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -637,7 +637,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -671,10 +671,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "PolicyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", "Roles": [ { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ] }, @@ -704,7 +704,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, @@ -720,8 +720,8 @@ "Timeout": 900 }, "DependsOn": [ - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "TableProviderframeworkonEventServiceRoleC3128F67" + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/manifest.json index 7b7d95733414a..243f52bf50866 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/654dac42f13b13875196142a61b0a246e6e649087142501c45c311291b0204d3.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b5e28c78e7f56fa21b428ffb431725d50cb22d29d89c5ef65a847a168d1e0a83.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -214,16 +214,16 @@ "data": "ClusterParameterGroup879806FD" } ], - "/aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleC3128F67" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ], - "/aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC" } ], "/aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/Resource": [ @@ -273,6 +273,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "TableProviderframeworkonEventServiceRoleC3128F67": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleC3128F67", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-redshift-distkey-create" @@ -294,7 +312,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/56d804c108ae167e92882443750bef6c2685937df49eec3dc5846e9bd8312330.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3f9f6343a4ca2c56d0d40f3b727131539c54bb65d8b7b6fdc0d81069d238b211.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -491,16 +509,16 @@ "data": "ClusterParameterGroup879806FD" } ], - "/aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleC3128F67" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ], - "/aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC" } ], "/aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/Resource": [ @@ -550,6 +568,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "TableProviderframeworkonEventServiceRoleC3128F67": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleC3128F67", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-redshift-distkey-update" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/tree.json index 49709acc56f11..e4c71a3e18415 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-distkey.js.snapshot/tree.json @@ -946,131 +946,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "roles": [ - { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "roles": [ + { + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-distkey-create/Table/Resource/Provider/framework-onEvent/Code", @@ -1123,7 +1123,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, @@ -2339,131 +2339,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "roles": [ - { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "roles": [ + { + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-distkey-update/Table/Resource/Provider/framework-onEvent/Code", @@ -2516,7 +2516,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/manifest.json index 26f48b71b3bb0..e55eaff4f277d 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7b8d2dedda432de023f03f880a44a293c30f67b52abd2778f835a7806238c2f0.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a1bc29bb108915f08a1477a87f5c3a95c77182591035e946366e706dd5ff1cf4.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -214,16 +214,16 @@ "data": "UserSecretAttachment02022609" } ], - "/redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "UserProviderframeworkonEventServiceRole8FBA2FBD" + "data": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" } ], - "/redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F" + "data": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C" } ], "/redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/Resource": [ @@ -273,6 +273,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "UserProviderframeworkonEventServiceRole8FBA2FBD": [ + { + "type": "aws:cdk:logicalId", + "data": "UserProviderframeworkonEventServiceRole8FBA2FBD", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F": [ + { + "type": "aws:cdk:logicalId", + "data": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "redshift-exclude-characters-integ" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.assets.json index ef3f29aa85bc2..e5b44e3834dd3 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.assets.json @@ -27,7 +27,7 @@ } } }, - "7b8d2dedda432de023f03f880a44a293c30f67b52abd2778f835a7806238c2f0": { + "a1bc29bb108915f08a1477a87f5c3a95c77182591035e946366e706dd5ff1cf4": { "source": { "path": "redshift-exclude-characters-integ.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7b8d2dedda432de023f03f880a44a293c30f67b52abd2778f835a7806238c2f0.json", + "objectKey": "a1bc29bb108915f08a1477a87f5c3a95c77182591035e946366e706dd5ff1cf4.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.template.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.template.json index ddb1a75f917b9..c9f30923d73e6 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.template.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/redshift-exclude-characters-integ.template.json @@ -523,7 +523,7 @@ "TargetType": "AWS::Redshift::Cluster" } }, - "UserProviderframeworkonEventServiceRole8FBA2FBD": { + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -554,7 +554,7 @@ ] } }, - "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F": { + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -588,10 +588,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", + "PolicyName": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C", "Roles": [ { - "Ref": "UserProviderframeworkonEventServiceRole8FBA2FBD" + "Ref": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" } ] } @@ -619,7 +619,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "UserProviderframeworkonEventServiceRole8FBA2FBD", + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316", "Arn" ] }, @@ -635,8 +635,8 @@ "Timeout": 900 }, "DependsOn": [ - "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", - "UserProviderframeworkonEventServiceRole8FBA2FBD" + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C", + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" ] }, "UserFDDCDD17": { diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/tree.json index 6d9177c9ec747..0e6b19af0b366 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.cluster-exclude-characters.js.snapshot/tree.json @@ -917,131 +917,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "redshift-exclude-characters-integ/User/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "redshift-exclude-characters-integ/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", - "roles": [ - { - "Ref": "UserProviderframeworkonEventServiceRole8FBA2FBD" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C", + "roles": [ + { + "Ref": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "redshift-exclude-characters-integ/User/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "redshift-exclude-characters-integ/User/Resource/Provider/framework-onEvent/Code", @@ -1094,7 +1094,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "UserProviderframeworkonEventServiceRole8FBA2FBD", + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316", "Arn" ] }, diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json index 886952b5911fa..b820632ab7777 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json @@ -27,7 +27,7 @@ } } }, - "3bb5577706470becf32d04544c930065ae1598618f5a65af6a32c5b4b58a2390": { + "02f365b755a06a3174b7729519d14c929722033cbb1cb6ee0287dc6bcca11bed": { "source": { "path": "aws-cdk-redshift-cluster-database.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "3bb5577706470becf32d04544c930065ae1598618f5a65af6a32c5b4b58a2390.json", + "objectKey": "02f365b755a06a3174b7729519d14c929722033cbb1cb6ee0287dc6bcca11bed.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json index 06fb5b12d98ba..299708dfdc0b1 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json @@ -586,7 +586,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleC3128F67": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -619,7 +619,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -653,10 +653,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "PolicyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", "Roles": [ { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ] }, @@ -686,7 +686,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, @@ -702,8 +702,8 @@ "Timeout": 900 }, "DependsOn": [ - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "TableProviderframeworkonEventServiceRoleC3128F67" + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json index 205522445558c..541728dc53a7b 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3bb5577706470becf32d04544c930065ae1598618f5a65af6a32c5b4b58a2390.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/02f365b755a06a3174b7729519d14c929722033cbb1cb6ee0287dc6bcca11bed.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -208,16 +208,16 @@ "data": "ClusterEB0386A7" } ], - "/aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleC3128F67" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ], - "/aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC" } ], "/aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/Resource": [ @@ -267,6 +267,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "TableProviderframeworkonEventServiceRoleC3128F67": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleC3128F67", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-redshift-cluster-database" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json index cbb76a6f9f815..654ca738d3e14 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json @@ -912,131 +912,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "roles": [ - { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "roles": [ + { + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/Code", @@ -1089,7 +1089,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json index cf83c628f04ac..8aa2843ad60bc 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json @@ -27,7 +27,7 @@ } } }, - "e11f0479a680ff60a4cf25c470573e7db9226fbeccdd309f5b60ef7e37438f7d": { + "e1d1faf313373c1370406453c53b054005322c79f95e3a6d2d6d6d05e0a576af": { "source": { "path": "aws-cdk-redshift-cluster-database.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e11f0479a680ff60a4cf25c470573e7db9226fbeccdd309f5b60ef7e37438f7d.json", + "objectKey": "e1d1faf313373c1370406453c53b054005322c79f95e3a6d2d6d6d05e0a576af.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json index 6ac7b6b834184..c7866464d0487 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json @@ -631,7 +631,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "UserProviderframeworkonEventServiceRole8FBA2FBD": { + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -664,7 +664,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F": { + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -698,10 +698,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", + "PolicyName": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C", "Roles": [ { - "Ref": "UserProviderframeworkonEventServiceRole8FBA2FBD" + "Ref": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" } ] }, @@ -731,7 +731,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "UserProviderframeworkonEventServiceRole8FBA2FBD", + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316", "Arn" ] }, @@ -747,8 +747,8 @@ "Timeout": 900 }, "DependsOn": [ - "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", - "UserProviderframeworkonEventServiceRole8FBA2FBD" + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C", + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -778,7 +778,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A": { + "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -811,7 +811,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C": { + "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy61F793AA": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -845,10 +845,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", + "PolicyName": "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy61F793AA", "Roles": [ { - "Ref": "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" + "Ref": "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1" } ] }, @@ -878,7 +878,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A", + "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1", "Arn" ] }, @@ -894,8 +894,8 @@ "Timeout": 900 }, "DependsOn": [ - "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" + "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy61F793AA", + "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -1057,7 +1057,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleC3128F67": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -1090,7 +1090,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": { + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -1124,10 +1124,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "PolicyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", "Roles": [ { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ] }, @@ -1157,7 +1157,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, @@ -1173,8 +1173,8 @@ "Timeout": 900 }, "DependsOn": [ - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "TableProviderframeworkonEventServiceRoleC3128F67" + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -1232,7 +1232,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB": { + "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -1265,7 +1265,7 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F": { + "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy1B2A66FA": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -1299,10 +1299,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F", + "PolicyName": "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy1B2A66FA", "Roles": [ { - "Ref": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB" + "Ref": "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B" } ] }, @@ -1332,7 +1332,7 @@ "Handler": "framework.onEvent", "Role": { "Fn::GetAtt": [ - "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB", + "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B", "Arn" ] }, @@ -1348,8 +1348,8 @@ "Timeout": 900 }, "DependsOn": [ - "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F", - "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB" + "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy1B2A66FA", + "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B" ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/manifest.json index 2a38be6d1969c..52fd793f2fb3f 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e11f0479a680ff60a4cf25c470573e7db9226fbeccdd309f5b60ef7e37438f7d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e1d1faf313373c1370406453c53b054005322c79f95e3a6d2d6d6d05e0a576af.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -226,16 +226,16 @@ "data": "UserSecretAttachment02022609" } ], - "/aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "UserProviderframeworkonEventServiceRole8FBA2FBD" + "data": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" } ], - "/aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F" + "data": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C" } ], "/aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/Resource": [ @@ -250,16 +250,16 @@ "data": "UserFDDCDD17" } ], - "/aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" + "data": "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1" } ], - "/aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C" + "data": "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy61F793AA" } ], "/aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/Resource": [ @@ -298,16 +298,16 @@ "data": "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997" } ], - "/aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleC3128F67" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" } ], - "/aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D" + "data": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC" } ], "/aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/Resource": [ @@ -322,16 +322,16 @@ "data": "Table7ABB320E" } ], - "/aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole/Resource": [ + "/aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB" + "data": "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B" } ], - "/aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F" + "data": "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy1B2A66FA" } ], "/aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/Resource": [ @@ -357,6 +357,78 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "UserProviderframeworkonEventServiceRole8FBA2FBD": [ + { + "type": "aws:cdk:logicalId", + "data": "UserProviderframeworkonEventServiceRole8FBA2FBD", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F": [ + { + "type": "aws:cdk:logicalId", + "data": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A": [ + { + "type": "aws:cdk:logicalId", + "data": "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C": [ + { + "type": "aws:cdk:logicalId", + "data": "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableProviderframeworkonEventServiceRoleC3128F67": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleC3128F67", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": [ + { + "type": "aws:cdk:logicalId", + "data": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB": [ + { + "type": "aws:cdk:logicalId", + "data": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F": [ + { + "type": "aws:cdk:logicalId", + "data": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-redshift-cluster-database" diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/tree.json index b2d0085d03b4a..ec9a0fb507681 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database.js.snapshot/tree.json @@ -1005,131 +1005,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", - "roles": [ - { - "Ref": "UserProviderframeworkonEventServiceRole8FBA2FBD" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy3F47723C", + "roles": [ + { + "Ref": "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-cluster-database/User/Resource/Provider/framework-onEvent/Code", @@ -1182,7 +1182,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "UserProviderframeworkonEventServiceRole8FBA2FBD", + "UserQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleE9658316", "Arn" ] }, @@ -1255,131 +1255,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", - "roles": [ - { - "Ref": "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy61F793AA", + "roles": [ + { + "Ref": "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider/framework-onEvent/Code", @@ -1432,7 +1432,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A", + "UserTablePrivilegesQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole9674DCD1", "Arn" ] }, @@ -1711,131 +1711,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "roles": [ - { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicyBBFA0AEC", + "roles": [ + { + "Ref": "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-cluster-database/Table/Resource/Provider/framework-onEvent/Code", @@ -1888,7 +1888,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", + "TableQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole71E75E1A", "Arn" ] }, @@ -1967,131 +1967,131 @@ "version": "0.0.0" } }, - "Provider": { - "id": "Provider", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider", + "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole", "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole", - "children": { - "ImportServiceRole": { - "id": "ImportServiceRole", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole/ImportServiceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole": { + "id": "ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/ImportQuery Redshift Database3de5bea727da479686625efb56431b5fProviderRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Query Redshift Database3de5bea727da479686625efb56431b5fProviderRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" }, - "policyName": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRoleDefaultPolicy6C272C6F", - "roles": [ - { - "Ref": "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] } - } + ], + "Version": "2012-10-17" }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" - } + "policyName": "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRoleDefaultPolicy1B2A66FA", + "roles": [ + { + "Ref": "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B" + } + ] } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", "version": "0.0.0" } - }, + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Provider": { + "id": "Provider", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider", + "children": { + "framework-onEvent": { + "id": "framework-onEvent", + "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent", + "children": { "Code": { "id": "Code", "path": "aws-cdk-redshift-cluster-database/TableWithAutoGeneratedName/Resource/Provider/framework-onEvent/Code", @@ -2144,7 +2144,7 @@ "handler": "framework.onEvent", "role": { "Fn::GetAtt": [ - "TableWithAutoGeneratedNameProviderframeworkonEventServiceRole9F1876DB", + "TableWithAutoGeneratedNameQueryRedshiftDatabase3de5bea727da479686625efb56431b5fProviderRole74C9EC6B", "Arn" ] }, diff --git a/packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts b/packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts index 197e7e005d985..058a734f9385e 100644 --- a/packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts @@ -58,12 +58,18 @@ export class SingletonFunction extends FunctionBase { */ public readonly runtime: Runtime; + /** + * The name of the singleton function. It acts as a unique ID within its CDK stack. + * */ + public readonly constructName: string; + protected readonly canCreatePermissions: boolean; private lambdaFunction: LambdaFunction; constructor(scope: Construct, id: string, props: SingletonFunctionProps) { super(scope, id); + this.constructName = (props.lambdaPurpose || 'SingletonLambda') + slugify(props.uuid); this.lambdaFunction = this.ensureLambda(props); this.permissionsNode = this.lambdaFunction.node; this.architecture = this.lambdaFunction.architecture; @@ -185,14 +191,13 @@ export class SingletonFunction extends FunctionBase { } private ensureLambda(props: SingletonFunctionProps): LambdaFunction { - const constructName = (props.lambdaPurpose || 'SingletonLambda') + slugify(props.uuid); - const existing = cdk.Stack.of(this).node.tryFindChild(constructName); + const existing = cdk.Stack.of(this).node.tryFindChild(this.constructName); if (existing) { // Just assume this is true return existing as LambdaFunction; } - return new LambdaFunction(cdk.Stack.of(this), constructName, props); + return new LambdaFunction(cdk.Stack.of(this), this.constructName, props); } }