Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception getting availability zones using non-default provider #731

Closed
shanehull opened this issue Feb 21, 2022 · 5 comments
Closed

Exception getting availability zones using non-default provider #731

shanehull opened this issue Feb 21, 2022 · 5 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@shanehull
Copy link

shanehull commented Feb 21, 2022

Hello!

  • Vote on this issue by adding a 👍 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)

Issue details

Steps to reproduce

  1. Create a role and a role policy to assume
  2. Create an AWS provider that assumes the role
  3. Attempt to create a VPC using awsx.ec2.Vpc with explicit provider

Code to reproduce is here:
https://github.com/shed909/pulumi-provider-assume-role-repro

Expected:
A VPC should be created using the declared provider, assuming the Pulumi role and using the specified region.

Actual:

Pulumi outputs the following error:

    error: TypeError: Cannot read properties of undefined (reading 'length')
        at getAvailabilityZones (/home/shane/swell/swell-infrastructure-mvp/node_modules/@pulumi/ec2/vpc.ts:510:22)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at Vpc.initializeVpcArgs (/home/shane/swell/swell-infrastructure-mvp/node_modules/@pulumi/ec2/vpc.ts:330:35)

Possibly related to pulumi/pulumi-aws#673, but I'm getting a different error. I have implemented the workaround described in that thread, as well as messing around with different dependsOn args.
It seems to be limited to the awsx provider, eg. EKS resources are being created in my main project if I remove awsx from the picture.

@shanehull shanehull added the kind/bug Some behavior is incorrect or out of spec label Feb 21, 2022
@jkodroff jkodroff transferred this issue from pulumi/pulumi-aws Feb 25, 2022
@viveklak
Copy link
Contributor

A bit confused. Why aren't you able to use the arn for the assumeRole.roleArn field directly (and not require the await)? Does that cause the same error?

cc @danielrbradley in case this is relevant to the MLC version of the component.

@shanehull
Copy link
Author

Using the ARN directly results in the same error. The await is likely irrelevant.

@shanehull
Copy link
Author

@danielrbradley have you had a chance to take a look at this?

As a workaround currently, I'm just creating a provider without an assumed role for this specific task (eg. the user of my AWS keys has permissions required to create a VPC).

Let me know if I can provider more info.

@danielrbradley danielrbradley changed the title Unable to assume runtime generated role for explicit awsx provider Excepiton getting availability zones using non-default provider May 16, 2022
@danielrbradley danielrbradley changed the title Excepiton getting availability zones using non-default provider Exception getting availability zones using non-default provider May 16, 2022
@danielrbradley
Copy link
Member

danielrbradley commented May 16, 2022

I've had a quick dig into this and agree there's a secondary issue from the instantiation of the provider from the created role. I still need to dig into why the aws.getAvailabilityZones returns an empty result, there appears to be something else at play here.

@danielrbradley danielrbradley added the resolution/fixed This issue was fixed label May 17, 2022
@danielrbradley
Copy link
Member

I've now tested and ensured this works in the new implementation in #843, we're only applying security fixes to the classic implementation.

This will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants