Skip to content

Unable to get module to parse cross-account assumed role within AWS #60

Description

@westinn

Currently I am running this module within an EC2 server as a Caddy Docker container within a developer AWS account (ACCOUNT_A). This EC2 machine has access to a set of Route53 resources on another account (ACCOUNT_B) via an attached IAM Role. The trust policies are in place cross-account, and when assigning proper AWS creds via a Bash script to query metadata and setting ENV variables for testing, this module is able to assume the role fine.

When I forgo this more manual environment setting script and allow the Caddy container to assume the roles automatically, I am getting failures. Is there a way to tell this module to attempt to assume a role? I was reading that the AWS SDK allows for this.

Logs:

Within the logs I see explicit failures to access the resources that worked previously, and it seems to be because it is using the developer accounts role, rather than assuming a role cross-account as it should. I have read that passing the target AWS_ROLE_ARN (as a Docker env variable) should work, as the AWS SDK will attempt to reach it. For example within my Docker Compose: AWS_ROLE_ARN: arn:aws:iam::ACCOUNT_B:role/dev-machine-role.

Here is my error with some info omitted. I'd expect to see the correct AWS Account ID at the very least since I'm specifying a target ARN as stated above.

2025/07/15 21:53:24.558 ERROR   tls.obtain      could not get certificate from issuer   {"identifier": "*.subdomain.test.com", "issuer": "acme-v02.api.letsencrypt.org-directory", "error": "[*.subdomain.test.com] solving challenges: presenting for challenge: adding temporary record for zone \"test.com.\": operation error Route 53: ListResourceRecordSets, https response error StatusCode: 403, api error AccessDenied: User: arn:aws:sts::ACCOUNT_A:assumed-role/dev-machine-role/i-123 is not authorized to access this resource"}

Does this error signify that the modules SDK is picking up role information incorrectly? Or is it something on my end?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions