Skip to content

API Gateway Dependent on Role Creation #12370

Answered by Tybot204
Tybot204 asked this question in Q&A
Discussion options

You must be logged in to vote

I think I may have found a solution after posting. I tried using a direct Ref for MyCustomRole and it appears to return the name that I'm looking for, and now creates a dependency in Cloudformation since that role must return it's ref first:

provider:
  apiGateway:
    resourcePolicy:
      - Effect: Allow
        Principal:
          AWS:
            - Fn::Join:
              - "/"
              - - arn:aws:sts::${aws:accountId}:assumed-role
                - Ref: MyCustomRole
                - role
        Action: execute-api:Invoke
        Resource:
          - execute-api:/*/*/*

# Other function config here...

resources:
  Resources:
    MyCustomRole:
      Type: AWS::IAM::Role
    …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Tybot204
Comment options

Answer selected by Tybot204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant