Skip to content

Commit

Permalink
Adopted for AWS China
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyZh committed Sep 12, 2024
1 parent 043b26f commit 87ee967
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ Resources:
Principal:
Service: "lambda.amazonaws.com"
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
- arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
- !Sub "arn:${AWS::Partition}:iam::aws:policy/AWSXrayWriteOnlyAccess"
Policies:
- PolicyName: CustomLambdaPolicy
PolicyDocument:
Expand All @@ -311,8 +311,8 @@ Resources:
- s3:PutObjectAcl
- s3:ListBucket
Resource:
- !Sub "arn:aws:s3:::${BucketNamePrefix}-${AWS::AccountId}-${AWS::Region}"
- !Sub "arn:aws:s3:::${BucketNamePrefix}-${AWS::AccountId}-${AWS::Region}/*"
- !Sub "arn:${AWS::Partition}:s3:::${BucketNamePrefix}-${AWS::AccountId}-${AWS::Region}"
- !Sub "arn:${AWS::Partition}:s3:::${BucketNamePrefix}-${AWS::AccountId}-${AWS::Region}/*"
- Sid: KMSGetDataPolicy
Effect: Allow
Action:
Expand All @@ -339,15 +339,15 @@ Resources:
- Sid: AllowIAMThisAccount
Effect: Allow
Principal:
AWS: !Sub "arn:aws:iam::${AWS::AccountId}:root"
AWS: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:root"
Action: "kms:*"
Resource: "*"
- Sid: AllowAWSLambdaToRetrieveKMSKey
Effect: Allow
Principal:
Service: "lambda.amazonaws.com"
#AWS: !GetAtt LambdaFunctionRole.Arn # Fails because circular reference
#AWS: !Sub "arn:aws:iam::${AWS::AccountId}:role/serverless-idp-scim-sync-${AWS::AccountId}-${AWS::Region}" # Fails in runtime because the roles is not created yet
#AWS: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/serverless-idp-scim-sync-${AWS::AccountId}-${AWS::Region}" # Fails in runtime because the roles is not created yet
Action:
- kms:Encrypt
- kms:Decrypt
Expand Down Expand Up @@ -380,7 +380,7 @@ Resources:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
KMSMasterKeyID: !Sub "arn:aws:kms:${AWS::Region}:${AWS::AccountId}:${KMSKeyAlias}"
KMSMasterKeyID: !Sub "arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:${KMSKeyAlias}"
SSEAlgorithm: "aws:kms"
BucketKeyEnabled: true # https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html

Expand All @@ -394,7 +394,7 @@ Resources:
- Sid: AllowAWSLambdaFunction
Principal:
AWS:
- !Sub "arn:aws:iam::${AWS::AccountId}:role/serverless-idp-scim-sync-${AWS::AccountId}-${AWS::Region}"
- !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/serverless-idp-scim-sync-${AWS::AccountId}-${AWS::Region}"
Effect: Allow
Action:
- s3:GetObject
Expand Down

0 comments on commit 87ee967

Please sign in to comment.