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

feat: set format for AWS region value in the provider definition #1549

Merged
merged 6 commits into from
Oct 30, 2023

Conversation

marcosuma
Copy link
Collaborator

@marcosuma marcosuma commented Oct 24, 2023

Description

When authenticating with an aws_role (see example below), the AWS region value must be lowercase and with - symbol. Considering that we allow to consume the region value also from environment variables and that it is generally allowed to have multiple ways to identify the region (e.g. in MongoDB Atlas we use the convention US_EAST_1 instead of us-east-1), this change make sure that the region value is always converted to its right format.

provider "mongodbatlas" {
  assume_role {
    role_arn = "arn:aws:iam::358363220050:role/agustin-role-for-sts"
  }
  secret_name           = "testing-terraform-provider-with-aws-sm"
  region                = "eu-north-1"
  aws_access_key_id     = "<temporary sts access key>"
  aws_secret_access_key = "<temporary sts secret access key>"
  aws_session_token     = "<temporary sts session token>"
  sts_endpoint          = "https://sts.eu-north-1.amazonaws.com/"
} 

Link to any related issue(s): https://jira.mongodb.org/browse/INTMDB-1034

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.

Further comments

@marcosuma marcosuma changed the title feat: Intmdb 1034 fix aws region env variable bug feat: set format for AWS region value in the provider definition Oct 24, 2023
@marcosuma marcosuma marked this pull request as ready for review October 24, 2023 12:51
@marcosuma marcosuma requested a review from a team as a code owner October 24, 2023 12:51
mongodbatlas/provider.go Outdated Show resolved Hide resolved
…with an AWS Role (#1551)

* set all possible default values taken from environment varialbes (if exist).

* addresses comments.

* feat: adds test coverage for AWS Role Authentication (#1552)

* adds test coverage.

* pre-check that regular credentials env variables are not set.

* feat: adds test infrastructure to run acceptance tests on PRs (#1553)

* adds test infra.

* fix.

* Update mongodbatlas/provider.go

Co-authored-by: Leo Antoli <430982+lantoli@users.noreply.github.com>

* Update mongodbatlas/provider.go

Co-authored-by: Leo Antoli <430982+lantoli@users.noreply.github.com>

* addresses comments.

---------

Co-authored-by: Leo Antoli <430982+lantoli@users.noreply.github.com>
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Health
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas 2%
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/validator 68%
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util 17%
Summary 3% (272 / 10318)

@marcosuma marcosuma merged commit 6df6ad6 into master Oct 30, 2023
21 checks passed
@marcosuma marcosuma deleted the INTMDB-1034-fix-aws-region-env-variable-bug branch October 30, 2023 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants