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

refactor: Migrate mongodbatlas_encryption_at_rest to Terraform Plugin Framework #1383

Merged

Conversation

maastha
Copy link
Collaborator

@maastha maastha commented Aug 11, 2023

Description

Please include a summary of the fix/feature/change, including any relevant motivation and context.

Link to any related issue(s):

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

Migration and acceptance tests run locally:
Screenshot 2023-08-23 at 12 34 16

Import:
Screenshot 2023-08-22 at 23 38 13
Resource in state after import:

  {
      "mode": "managed",
      "type": "mongodbatlas_encryption_at_rest",
      "name": "example",
      "provider": "provider[\"registry.terraform.io/mongodb/mongodbatlas\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "aws_kms_config": [
              {
                "access_key_id": null,
                "customer_master_key_id": "arn:aws:kms:us-east-1:....................xxxxxxxxxxxxxxxxxxxxxxxxxx",
                "enabled": true,
                "region": "US_EAST_1",
                "role_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "secret_access_key": null
              }
            ],
            "azure_key_vault_config": [
              {
                "azure_environment": "",
                "client_id": "",
                "enabled": false,
                "key_identifier": "",
                "key_vault_name": "",
                "resource_group_name": "",
                "secret": null,
                "subscription_id": "",
                "tenant_id": ""
              }
            ],
            "google_cloud_kms_config": [
              {
                "enabled": false,
                "key_version_resource_id": "",
                "service_account_key": null
              }
            ],
            "id": "63bec58b014da65b8f73c06c",
            "project_id": "63bec58b014da65b8f73c06c"
          },
          "sensitive_attributes": []
        }
      ]
    },

@maastha maastha marked this pull request as ready for review August 23, 2023 12:45
@maastha maastha requested a review from a team as a code owner August 23, 2023 12:45
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

Comment on lines +243 to +248
strings.Contains(err.Error(), "CLOUD_PROVIDER_ACCESS_ROLE_NOT_AUTHORIZED") {
log.Printf("warning issue performing authorize EncryptionsAtRest not done try again: %s \n", err.Error())
log.Println("retrying ")
time.Sleep(10 * time.Second)
encryptionAtRestReq.GroupID = projectID
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this logic already here? Can we use retry.StateChangeConf instead? you can file a ticket to improve the logic to use retry.StateChangeConf

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, this has been migrated as is. Created https://jira.mongodb.org/browse/INTMDB-1039

@maastha maastha merged commit 69f95a0 into CLOUDP-189585-plugin-framework-migration Aug 25, 2023
@maastha maastha deleted the INTMDB-998-migrate-EAR branch August 25, 2023 21:09
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