localstack icon indicating copy to clipboard operation
localstack copied to clipboard

bug: [cloudformation] Unknown parameter in RoleMappings.mapping: "IdentityProvider", must be one of: Type, AmbiguousRoleResolution, RulesConfiguration

Open merowinger92 opened this issue 4 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

I try to apply the cdk-identity-pool-example (https://github.com/bobbyhadz/cdk-identity-pool-example) and it seem that using a CfnIdentityPoolRoleAttachment causes following exception:

2022-03-14T08:52:36.333:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "Cognito::IdentityPoolRoleAttachment" id "identitypoolroleattachment"
2022-03-14T08:52:36.357:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "Cognito::IdentityPoolRoleAttachment" in region eu-central-1: set_identity_pool_roles {'IdentityPoolId': 'eu-central-1:b8880b67-684a-4155-8296-f1d4a0f2dde8', 'RoleMappings': {'mapping': {'AmbiguousRoleResolution': 'AuthenticatedRole', 'IdentityProvider': 'cognito-idp.eu-central-1.amazonaws.com/eu-central-1_d7b12c0ddfb5400da6fb5a4228b0ccf0:j25zqix56c2kf88trcj086akwr', 'Type': 'Token'}}, 'Roles': {'authenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-usersgrouprole5142F148-308fa73e', 'unauthenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-anonymousgrouprole4CF2AF-b9dec6f5'}}
2022-03-14T08:52:36.357:DEBUG:localstack.utils.cloudformation.template_deployer: Trying original parameters: {'IdentityPoolId': 'eu-central-1:b8880b67-684a-4155-8296-f1d4a0f2dde8', 'RoleMappings': {'mapping': {'AmbiguousRoleResolution': 'AuthenticatedRole', 'IdentityProvider': 'cognito-idp.eu-central-1.amazonaws.com/eu-central-1_d7b12c0ddfb5400da6fb5a4228b0ccf0:j25zqix56c2kf88trcj086akwr', 'Type': 'Token'}}, 'Roles': {'authenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-usersgrouprole5142F148-308fa73e', 'unauthenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-anonymousgrouprole4CF2AF-b9dec6f5'}}
2022-03-14T08:52:36.357:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.CognitoIdentity object at 0x7f0310f4d040>> with params: {'IdentityPoolId': 'eu-central-1:b8880b67-684a-4155-8296-f1d4a0f2dde8', 'RoleMappings': {'mapping': {'AmbiguousRoleResolution': 'AuthenticatedRole', 'IdentityProvider': 'cognito-idp.eu-central-1.amazonaws.com/eu-central-1_d7b12c0ddfb5400da6fb5a4228b0ccf0:j25zqix56c2kf88trcj086akwr', 'Type': 'Token'}}, 'Roles': {'authenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-usersgrouprole5142F148-308fa73e', 'unauthenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-anonymousgrouprole4CF2AF-b9dec6f5'}} for resource: {'Type': 'AWS::Cognito::IdentityPoolRoleAttachment', 'Metadata': {'aws:cdk:path': 'cdk-starter-stack/identity-pool-role-attachment'}, 'LogicalResourceId': 'identitypoolroleattachment', 'Properties': {'IdentityPoolId': 'eu-central-1:b8880b67-684a-4155-8296-f1d4a0f2dde8', 'RoleMappings': {'mapping': {'AmbiguousRoleResolution': 'AuthenticatedRole', 'IdentityProvider': 'cognito-idp.eu-central-1.amazonaws.com/eu-central-1_d7b12c0ddfb5400da6fb5a4228b0ccf0:j25zqix56c2kf88trcj086akwr', 'Type': 'Token'}}, 'Roles': {'authenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-usersgrouprole5142F148-308fa73e', 'unauthenticated': 'arn:aws:iam::000000000000:role/cdk-starter-stack-anonymousgrouprole4CF2AF-b9dec6f5'}}, '_state_': {}}
2022-03-14T08:52:36.358:DEBUG:localstack.utils.cloudformation.template_deployer: Error applying changes for CloudFormation stack "cdk-starter-stack": Parameter validation failed:
Unknown parameter in RoleMappings.mapping: "IdentityProvider", must be one of: Type, AmbiguousRoleResolution, RulesConfiguration Traceback (most recent call last):
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1527, in _run
self.do_apply_changes_in_loop(changes, stack, stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1599, in do_apply_changes_in_loop
self.apply_change(change, stack=stack)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1665, in apply_change
result = deploy_resource(self, resource_id)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 842, in deploy_resource
result = execute_resource_action(resource_id, stack, ACTION_CREATE)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 883, in execute_resource_action
result = configure_resource_via_sdk(
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1016, in configure_resource_via_sdk
raise e
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1006, in configure_resource_via_sdk
result = function(**params)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 395, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 695, in _make_api_call
request_dict = self._convert_to_request_dict(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 745, in _convert_to_request_dict
request_dict = self._serializer.serialize_to_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/validate.py", line 360, in serialize_to_request
raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in RoleMappings.mapping: "IdentityProvider", must be one of: Type, AmbiguousRoleResolution, RulesConfiguration

The stack is created correctly when created with cdk command instead of cdklocal

Expected Behavior

The cdk stack is created correctly when using cdklocal.

How are you starting LocalStack?

With the localstack script

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

    export LOCALSTACK_API_KEY=<your-api-key>
    export DEBUG=1
    localstack start

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

  1. Clone repository: https://github.com/bobbyhadz/cdk-identity-pool-example
  2. Install dependcies: npm install
  3. make sure cdklocal is installed: npm install -g aws-cdk-local aws-cdk
  4. deploy the stack with npx cdklocal deploy
  5. The deployment should fail and you should be able to see in the localstack logs the exception mentioned above.

Environment

- OS: Ubuntu 20.04
- LocalStack: 0.14.1 (67e92760)

Anything else?

No response

merowinger92 avatar Mar 14 '22 09:03 merowinger92