mongodb / terraform-provider-mongodbatlas

Terraform MongoDB Atlas Provider: Deploy, update, and manage MongoDB Atlas infrastructure as code through HashiCorp Terraform
https://registry.terraform.io/providers/mongodb/mongodbatlas
Mozilla Public License 2.0
230 stars 167 forks source link

feat: Adds new `mongodbatlas_control_plane_ip_addresses` data source #2331

Closed AgustinBettati closed 3 weeks ago

AgustinBettati commented 3 weeks ago

Description

Link to any related issue(s): CLOUDP-250897

Defines a new data source for the following endpoint: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Root/operation/returnAllControlPlaneIPAddresses

Example API response and resulting tf state ``` ---[ REQUEST ]--------------------------------------- GET /api/atlas/v2/unauth/controlPlaneIPAddresses HTTP/1.1 ---[ RESPONSE ]-------------------------------------- HTTP/2.0 200 OK { "inbound": { "aws": { "ap-southeast-1": [], "eu-west-1": [], }, "azure": { "australiaeast": [], "eastus2": [], }, "gcp": { "europe-west1": [], } }, "outbound": { "aws": { "ap-southeast-1": [ "54.66.0.167/32", "54.253.68.72/32" ], "eu-west-1": [ "54.78.184.167/32", "52.210.32.198/32" ], "us-east-1": [ "3.90.117.229/32", "3.224.224.200/32" ] }, "azure": { "australiaeast": [ "20.53.129.178/32" ], "eastus2": [ "20.94.32.37/32" ] }, "gcp": { "europe-west1": [ "34.78.42.14/32" ], "us-east4": [ "34.85.218.41/32" ] } } } ``` Resulting terraform state: ``` { "mode": "data", "type": "mongodbatlas_control_plane_ip_addresses", "name": "test", "provider": "provider[\"registry.terraform.io/mongodb/mongodbatlas\"]", "instances": [ { "schema_version": 0, "attributes": { "inbound": { "aws": { "ap-southeast-1": [], "eu-west-1": [] }, "azure": { "australiaeast": [], "eastus2": [], "westeurope": [] }, "gcp": { "europe-west1": [] } }, "outbound": { "aws": { "ap-southeast-1": [ "54.66.0.167/32", "54.253.68.72/32" ], "eu-west-1": [ "54.78.184.167/32", "52.210.32.198/32" ], "us-east-1": [ "3.90.117.229/32", "3.224.224.200/32" ] }, "azure": { "australiaeast": [ "20.53.129.178/32" ], "eastus2": [ "20.94.32.37/32" ] }, "gcp": { "europe-west1": [ "34.78.42.14/32" ], "us-east4": [ "34.85.218.41/32" ] } } } ... ```

Type of change:

Required Checklist:

Further comments

github-actions[bot] commented 3 weeks ago

APIx bot: a message has been sent to Docs Slack channel

marcosuma commented 3 weeks ago

Great job @AgustinBettati - did you use the automation to create the scaffolding?

Also +1 to @maastha sentiment, curious if we can come up with a smaller PR approach next time: biggest challenge is to make sure we don't miss smaller bugs such as misspells

AgustinBettati commented 3 weeks ago

did you use the automation to create the scaffolding?

@marcosuma yes for this case used initial file scaffolding, schema and model scaffolding, and then documentation autogeneration. Included some fixes to these tools along the way, related to our new file naming convention aligned with our latest resource push-based log export.

could this PR have been split into smaller ones?

@maastha yes I see how this got a little to big as many small changes were included. Would keep fixes related to scaffolding + setup in CI as separate PR to avoid additional noise to the actual production code. Thanks for the input and sorry if the review was a challenge here.

maastha commented 3 weeks ago

@maastha yes I see how this got a little to big as many small changes were included. Would keep fixes related to scaffolding + setup in CI as separate PR to avoid additional noise to the actual production code. Thanks for the input and sorry if the review was a challenge here.

no problem! Also, just FYI we do have a possible approach to split new feature PRs captured in our TF best practices doc, happy to discuss any alternatives/your general inputs there:)