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: Migrate DataSource: mongodbatlas_project_ip_access_list to Terraform Plugin Framework #1395

Merged

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Aug 17, 2023

Description

Ticket: INTMDB-975

This PR migrates mongodbatlas_project_ip_access_list to the new framework

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

Testing

In addition to the added acceptance tests I tested the data source locally in the following scenario:

  • Create IP access list entry in 1.11.0 + data source, upgrade to local build, run tf plan and verify plan was empty
tf plan
data.mongodbatlas_project_ip_access_list.test: Read complete after 0s [id=64df3738bbba4d088e1cbbdf-1.2.3.4]
data.mongodbatlas_database_user.test: Read complete after 0s [id=YXV0aF9kYXRhYmFzZV9uYW1l:YWRtaW4=-cHJvamVjdF9pZA==:NjRkZjM3MzhiYmJhNGQwODhlMWNiYmRm-dXNlcm5hbWU=:dGVzdA==]
2023-08-18T10:46:27.816+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-08-18T10:46:27.818+0100 [DEBUG] provider: plugin process exited: path=../bin/terraform-provider-mongodbatlas pid=96650
2023-08-18T10:46:27.818+0100 [DEBUG] provider: plugin exited
2023-08-18T10:46:27.820+0100 [DEBUG] no planned changes, skipping apply graph check
2023-08-18T10:46:27.820+0100 [INFO]  backend/local: plan operation completed

No changes. Your infrastructure matches the configuration.
  • Create IP access list entry + data source in local build
tf state
# data.mongodbatlas_project_ip_access_list.test-ip:
data "mongodbatlas_project_ip_access_list" "test-ip" {
    cidr_block = "1.2.3.4/32"
    comment    = "cidr block for tf acc testing"
    id         = "64df3738bbba4d088e1cbbdf-1.2.3.4"
    ip_address = "1.2.3.4"
    project_id = "64df3738bbba4d088e1cbbdf"
}

# data.mongodbatlas_project_ip_access_list.test:
data "mongodbatlas_project_ip_access_list" "test" {
    cidr_block = "1.2.3.4/32"
    comment    = "cidr block for tf acc testing"
    id         = "64df3738bbba4d088e1cbbdf-1.2.3.4"
    ip_address = "1.2.3.4"
    project_id = "64df3738bbba4d088e1cbbdf"
}

@@ -0,0 +1,61 @@
package validator
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added unit tests to the validators

@andreaangiolillo andreaangiolillo marked this pull request as ready for review August 18, 2023 10:56
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner August 18, 2023 10:56
@maastha maastha requested a review from AgustinBettati August 21, 2023 08:06
Copy link
Member

@AgustinBettati AgustinBettati 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 addressing comments from my side.

@andreaangiolillo andreaangiolillo merged commit 7aaa9f2 into CLOUDP-189585-plugin-framework-migration Aug 22, 2023
@andreaangiolillo andreaangiolillo deleted the INTMDB-975_2 branch August 22, 2023 09:50
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