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

fix multi-region with injected identity - after v2 migration v0.20.0 #913

Merged

Conversation

haarchri
Copy link
Member

@haarchri haarchri commented Nov 7, 2021

Signed-off-by: haarchri [email protected]

Description of your changes

added region for config.LoadDefaultConfig since it was dropped after v2 migration

v0.19.0:
https://github.com/crossplane/provider-aws/blob/release-0.19/pkg/clients/aws.go#L343

v0.20.0:
https://github.com/crossplane/provider-aws/blob/release-0.19/pkg/clients/aws.go#L234

Fixes Community Question from Slack:

Kelly Ferrone: For some reason all my aws resources end up in only one region? Why would this happen? Even though I say region: us-east-1
it is always
region: us-west-2
I see on provider-aws pod it does have AWS_REGION: us-west-2
Is this because of using the injected Identity

Milan Laketic: I can now confirm that I have the same behavior. On provider v0.19.1 I can normally provision in another region, but on latest I get resources in region where I'm assuming role

I have:

  • Read and followed Crossplane's [contribution process].
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

tested with go-sdk-v1 and go-sdk-v2 ressources:

---
apiVersion: efs.aws.crossplane.io/v1alpha1
kind: FileSystem
metadata:
  name: eu-west-1-efs
spec:
  forProvider:
    region: eu-west-1
  providerConfigRef:
    name: aws-provider
---
apiVersion: efs.aws.crossplane.io/v1alpha1
kind: FileSystem
metadata:
  name: eu-central-1-efs
spec:
  forProvider:
    region: eu-central-1
  providerConfigRef:
    name: aws-provider
---
apiVersion: ecr.aws.crossplane.io/v1alpha1
kind: Repository
metadata:
  name: eu-central-1-ecr
spec:
  forProvider:
    region: eu-central-1
    imageScanningConfiguration:
      scanOnPush: true
    imageTagMutability: IMMUTABLE
  providerConfigRef:
    name: aws-provider
---
apiVersion: ecr.aws.crossplane.io/v1alpha1
kind: Repository
metadata:
  name: eu-west-1-ecr
spec:
  forProvider:
    region: eu-west-1
    imageScanningConfiguration:
      scanOnPush: true
    imageTagMutability: IMMUTABLE
  providerConfigRef:
    name: aws-provider

@haarchri haarchri requested a review from muvaf November 10, 2021 23:40
cfg, err := config.LoadDefaultConfig(ctx)
cfg, err := config.LoadDefaultConfig(
ctx,
config.WithRegion(region),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work OK with IAM resources as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh just saw that we were doing it earlier already.

@haarchri
Copy link
Member Author

@muvaf is this something for backport in 0.20.0 ?

@muvaf
Copy link
Member

muvaf commented Nov 11, 2021

@haarchri I think so, yes.

@github-actions
Copy link

Successfully created backport PR #933 for release-0.20.

tektondeploy pushed a commit to gtn3010/provider-aws that referenced this pull request Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants