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: remove validation of empty public_key and private_key attributes in provider config to avoid breaking change #1402

Merged
merged 2 commits into from
Aug 23, 2023

Conversation

AgustinBettati
Copy link
Member

Description

Related tickets: INTMDB-999 (manual testing of provider configuration), INTMDB-971 (migration to framework provider, which included changes to the provider configuration)

During manual testing of the provider configuration using AWS Secrets Manager Authentication method, the following valid case was tested:

provider "mongodbatlas" {
  base_url = "https://cloud-dev.mongodb.com/"
  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     = "<access key>"
  aws_secret_access_key = "<secret access key>"
  aws_session_token     = "<sts session token>"
  sts_endpoint          = "https://sts.eu-north-1.amazonaws.com/"
}

Note: no environment variables defined.

  • In 1.11.0 this provider configuration correctly retrieves credentials stored in AWS Secret Manager and following resource definitions work as expected.
  • In our current migration branch (CLOUDP-189585-plugin-framework-migration) this case results in an error Error: attribute public_key must be set

Initially we defined validations for both of these attributes as we can see they are defined as required. However, since a default function is provided which will always return a value (either value from environment variables or simply empty string) these attributes can be left empty allowing support for cases like the above.

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

Further comments

… in provider config to avoid breaking change
@AgustinBettati AgustinBettati requested a review from a team as a code owner August 22, 2023 15:56
Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM. left one question that is not blocking. Thanks for fixing this bug

mongodbatlas/fw_provider.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the follow up changes 💯

Copy link
Collaborator

@maastha maastha left a comment

Choose a reason for hiding this comment

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

LGTM, nice one!

@AgustinBettati AgustinBettati merged commit 57cede4 into CLOUDP-189585-plugin-framework-migration Aug 23, 2023
@AgustinBettati AgustinBettati deleted the INTMDB-999 branch August 23, 2023 08:59
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.

3 participants