amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.
MIT License
941 stars 232 forks source link

deploymentRole not being assumed #583

Open gael-donat opened 1 year ago

gael-donat commented 1 year ago

Community Note

Bug Report

We are using a deployment Role in our serverless.yml :

provider:
  name: aws
  deploymentMethod: direct
  runtime: python3.9
  stage: ${opt:stage, 'local'}
  region: ${opt:region, 'eu-west-1'}
  stackName: ${self:service}-${sls:stage}
  memorySize: 512
  iam:
    deploymentRole: arn:aws:iam::xxxxxxxxx:role/${self:custom.shared.workload}-${sls:stage}-CloudFormationExecutionRole

the role is indeed use by servlerss as we can see it in cloudformation stack deployment :

IAM role arn:aws:iam::xxxxx:role/common-dev-CloudFormationExecutionRole

Error Description

The terminal output show an error where it's the user role that it is used and not the deployment for this plugin.

Command Run sls deploy --stage=dev Console Output

Error: Unable to create domain 'xxx-dev.xxx.com':
Failed to UPSERT A Alias for 'xxx-dev.xxx.com':

                    User: arn:aws:sts::xxx:assumed-role/SSO-Lead/firstname.lastname@xxx.com is not authorized to perform: route53:ChangeResourceRecordSets on resource: arn:aws:route53:::
hostedzone/xxxxxxx because no identity-based policy allows the route53:ChangeResourceRecordSets action
    at ServerlessCustomDomain.<anonymous> (/srv/node_modules/serverless-domain-manager/dist/src/index.js:256:23)
    at Generator.throw (<anonymous>)
    at rejected (/srv/node_modules/serverless-domain-manager/dist/src/index.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Domain Manager Configuration

customDomain:
    domainName: ${self:custom.domainName.${sls:stage}}
    stage: ${sls:stage}
    certificateName: '*.xxx.com'
    endpointType: EDGE
    securityPolicy: tls_1_2
    apiType: rest
    hostedZoneId: ABCDEFGHIJK
    hostedZonePrivate: false
    createRoute53Record: true
    createRoute53IPv6Record: false
    autoDomain: true

Versions

rddimon commented 1 year ago

Hi @gael-donat

Does it work for you with the v6.4.4 ?