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: adjust format of database user resource id as defined in previous versions #1506

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

AgustinBettati
Copy link
Member

@AgustinBettati AgustinBettati commented Oct 4, 2023

Description

Ticket: INTMDB-1172

Format defined in 1.11.1: https://github.com/mongodb/terraform-provider-mongodbatlas/blob/v1.11.1/mongodbatlas/resource_mongodbatlas_database_user.go#L256

Note: as of 1.12.x there is no usage of the id value within the database user resource, so it can be modified safely back to the format defined in 1.11.1.

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2023

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 20%
Summary 3% (279 / 10574)

@AgustinBettati AgustinBettati marked this pull request as ready for review October 4, 2023 11:54
@AgustinBettati AgustinBettati requested a review from a team as a code owner October 4, 2023 11:54
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

@@ -391,9 +390,14 @@ func newTFDatabaseUserModel(ctx context.Context, model *tfDatabaseUserModel, dbU
return nil, diagnostic
}

id := fmt.Sprintf("%s-%s-%s", dbUser.GroupID, dbUser.Username, dbUser.DatabaseName)
// ID is encoded to preserve format defined in previous versions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have to update splitDatabaseUserImportID at line 255? wondering if we are still able to use it

Copy link
Member Author

Choose a reason for hiding this comment

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

that line is handling the case of importing the resource, the format in that case is {project_id}-{username}-{auth_database_name} and should not change

@AgustinBettati AgustinBettati merged commit 586229f into master Oct 6, 2023
37 checks passed
@AgustinBettati AgustinBettati deleted the INTMDB-1172 branch October 6, 2023 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants