-
Notifications
You must be signed in to change notification settings - Fork 210
feat: Adds port_mapping_enabled attribute to privatelink_endpoint and privatelink_endpoint_service
#4017
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
base: CLOUDP-346617-dev-gcp-port-based
Are you sure you want to change the base?
feat: Adds port_mapping_enabled attribute to privatelink_endpoint and privatelink_endpoint_service
#4017
Changes from 16 commits
332be39
9175dce
8a9562f
ca4cacf
ed3e818
d6725b9
7545b99
3752b5a
cfb1e0f
3a32c9f
df750a7
be386c1
0c9b674
6d555dc
a719ede
07cfdb7
6484466
f06647e
5e36067
0397c6b
80e3fcb
5f5ef57
3ab8f39
48449c5
4c79e7a
e12b299
993a4bb
0d3dca5
4857fe5
7b2d7a7
652d1d4
75313b9
be194ad
3300c67
7b1899a
b7c615c
44cf301
01997bc
c145619
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ```release-note:enhancement | ||
| resource/mongodbatlas_privatelink_endpoint_service: Adds `port_mapping_enabled` attribute | ||
| ``` | ||
|
|
||
| ```release-note:enhancement | ||
| resource/mongodbatlas_privatelink_endpoint: Adds `port_mapping_enabled` attribute | ||
| ``` | ||
|
|
||
| ```release-note:enhancement | ||
| data-source/mongodbatlas_privatelink_endpoint_service: Adds `port_mapping_enabled` attribute | ||
| ``` | ||
|
|
||
| ```release-note:enhancement | ||
| data-source/mongodbatlas_privatelink_endpoint: Adds `port_mapping_enabled` attribute | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,5 +122,6 @@ In addition to all arguments above, the following attributes are exported: | |
| * `endpoint_name` - Forwarding rule that corresponds to the endpoint you created in GCP. | ||
| * `ip_address` - Private IP address of the network endpoint group you created in GCP. | ||
| * `status` - Status of the endpoint. Atlas returns one of the [values shown above](https://docs.atlas.mongodb.com/reference/api/private-endpoints-endpoint-create-one/#std-label-ref-status-field). | ||
| * `port_mapping_enabled` - Flag that indicates whether this endpoint service uses PSC port-mapping. | ||
|
||
|
|
||
| See [MongoDB Atlas API](https://docs.atlas.mongodb.com/reference/api/private-endpoints-endpoint-get-one/) Documentation for more information. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Example with GCP with Port-Based architecture and MongoDB Atlas Private Endpoint | ||
marcosuma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| This project demonstrates the **new PSC port-based architecture** for setting up GCP Private Service Connect with MongoDB Atlas, which requires only 1 endpoint. | ||
|
||
|
|
||
| ## Architecture Comparison | ||
|
|
||
| | Feature | Legacy Architecture | New Port-Based Architecture | | ||
| |---------|-------------------|---------------------------| | ||
| | Endpoints Required | 50 | 1 | | ||
| | `port_mapping_enabled` | `false` (or omitted) | `true` | | ||
|
|
||
| ## Dependencies | ||
|
|
||
| * Terraform v0.13+ | ||
| * Google Cloud account | ||
| * MongoDB Atlas account | ||
|
|
||
| ``` | ||
| Terraform v0.13.0 | ||
| + provider registry.terraform.io/hashicorp/google | ||
| + provider registry.terraform.io/terraform-providers/mongodbatlas | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| **1\. Ensure your Google credentials are set up.** | ||
|
|
||
| 1. Install the GCloud SDK by following the steps from the [official GCP documentation](https://cloud.google.com/sdk/docs/install). | ||
| 2. Run the command `gcloud init` and authenticate with GCP. | ||
| 3. Once authenticated you will need to select a project to use. After you select a project a success message will appear, see the example below. You are then ready to proceed. | ||
| ``` | ||
| ⇒ gcloud init | ||
| You are logged in as: [user@example.com]. | ||
| Pick cloud project to use: | ||
| [1] project1 | ||
| [2] project2 | ||
| ... | ||
| Please enter numeric choice or text value (must exactly match list item): 1 | ||
| Your Google Cloud SDK is configured and ready to use! | ||
| ``` | ||
| **2\. TFVARS** | ||
|
|
||
| Now create **terraform.tfvars** file with all the variable values and make sure **not to commit it**. | ||
|
|
||
| An existing cluster on the project can optionally be linked via the `cluster_name` variable. | ||
| If included, the gcp connection string to the cluster will be output. | ||
|
|
||
| **3\. Review the Terraform plan.** | ||
|
|
||
| Execute the below command and ensure you are happy with the plan. | ||
|
|
||
| ``` bash | ||
| $ terraform plan | ||
| ``` | ||
| This project currently does the below deployments: | ||
|
|
||
| - MongoDB Atlas GCP Private Endpoint (using new PSC port-based architecture with 1 endpoint) | ||
| - Google resource Compute Network, SubNetwork, Address and Forwarding Rule | ||
| - Google Private Service Connect (PSC)-MongoDB Private Link | ||
|
|
||
| **4\. Execute the Terraform apply.** | ||
|
|
||
| Now execute the plan to provision the GCP resources. | ||
|
|
||
| ``` bash | ||
| $ terraform apply | ||
| ``` | ||
|
|
||
| **5\. Destroy the resources.** | ||
|
|
||
| Once you are finished your testing, ensure you destroy the resources to avoid unnecessary GCP and Atlas charges. | ||
|
|
||
| ``` bash | ||
| $ terraform destroy | ||
| ``` | ||
|
|
||
| ## Key Differences from Legacy Architecture | ||
|
|
||
| The main difference in this example is the `port_mapping_enabled = true` setting on the `mongodbatlas_privatelink_endpoint` resource: | ||
|
|
||
| ```hcl | ||
| resource "mongodbatlas_privatelink_endpoint" "test" { | ||
| project_id = var.project_id | ||
| provider_name = "GCP" | ||
| region = var.gcp_region | ||
| port_mapping_enabled = true # This enables the new architecture | ||
| # ... | ||
| } | ||
| ``` | ||
|
|
||
| With this setting: | ||
| - Only **1 Google Compute Address** is needed (instead of 50) | ||
| - Only **1 Google Compute Forwarding Rule** is needed (instead of 50) | ||
| - The `endpoints` block in `mongodbatlas_privatelink_endpoint_service` contains exactly **1 endpoint** | ||
|
|
||
| For the legacy architecture example (50 endpoints), see the [`gcp/`](../gcp/) directory example. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only other resource and ds in Private Endpoint Services group is https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/private_endpoint_regional_mode, can you confirm nothing changes there?