File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
cloudformation/custom_resource
tests/integration-tests/tests/custom_resource Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ CHANGELOG
2626
2727** BUG FIXES**
2828- Add validation to ` ScaledownIdletime ` value, to prevent setting a value lower than ` -1 ` .
29+ - Fix issue causing dangling IAM policies to be created when creating ParallelCluster CloudFormation custom resource provider with ` CustomLambdaRole ` .
2930
30313.6.1
3132------
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ Resources:
6868 LogGroupName : !Sub /aws/lambda/${PclusterCfnFunction}
6969
7070 EventsPolicy :
71+ Condition : UsePCPolicies
7172 Type : AWS::IAM::ManagedPolicy
7273 Properties :
7374 PolicyDocument :
@@ -82,6 +83,7 @@ Resources:
8283 - events:RemoveTargets
8384 Resource : !Sub arn:${AWS::Partition}:events:${AWS::Region}:${AWS::AccountId}:rule/*
8485 S3Policy :
86+ Condition : UsePCPolicies
8587 Type : AWS::IAM::ManagedPolicy
8688 Properties :
8789 PolicyDocument :
Original file line number Diff line number Diff line change @@ -319,15 +319,27 @@ def test_cluster_create_with_custom_policies(
319319):
320320 """Create a custom resource provider with a custom role and create a cluster to validate it."""
321321 parameters = {"CustomBucket" : resource_bucket , stack_param : resource_bucket_policies .cfn_outputs [cfn_output ]}
322+ provider_stack_name = generate_stack_name (
323+ "integ-test-custom-resource-provider" , request .config .getoption ("stackname_suffix" )
324+ )
322325 custom_resource_gen = cluster_custom_resource_provider_generator (
323326 cfn_stacks_factory ,
324327 region ,
325- generate_stack_name ( "integ-test-custom-resource-provider" , request . config . getoption ( "stackname_suffix" )) ,
328+ provider_stack_name ,
326329 parameters ,
327330 cluster_custom_resource_provider_template ,
328331 )
329332 service_token = next (custom_resource_gen )
330333
334+ if stack_param == "CustomLambdaRole" :
335+ logging .info ("Checking no IAM resources are created when CustomLambdaRole is specified" )
336+ resources = boto3 .client ("cloudformation" ).describe_stack_resources (StackName = provider_stack_name )[
337+ "StackResources"
338+ ]
339+ for resource in resources :
340+ resource_type = resource ["ResourceType" ]
341+ assert_that (resource_type ).does_not_contain ("AWS::IAM::" )
342+
331343 stack = cluster_custom_resource_factory (pcluster_config_reader (), service_token = service_token )
332344 cluster_name = _stack_parameter (stack , "ClusterName" )
333345 cluster = pc ().list_clusters (query = f"clusters[?clusterName=='{ cluster_name } ']|[0]" )
You can’t perform that action at this time.
0 commit comments