-
Notifications
You must be signed in to change notification settings - Fork 212
feat: Private Link Online Archive add Azure support #4355
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
Changes from 24 commits
3e715f5
4313385
2d89eb8
b3f33c3
2391479
87ba1f4
de32022
198ed7f
dac653c
f17a807
4b23ed9
2c74e4a
e0358dc
0802bc1
4b97d91
df6f598
559e061
b2559dd
78ea010
441fe0d
b40a8cd
9599167
e947fa0
cf1e5a5
33ef061
3a1279f
41835cf
056be60
4a809d3
c3963f2
2f382af
84bceeb
7c3d74a
6f9a26b
4d232a0
31a7f57
013ba00
9e41a03
35c7d53
e8ea58a
cde4744
b227d2a
c7b7c0d
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,4 @@ | ||
| ```release-note:enhancement | ||
| resource/mongodbatlas_privatelink_endpoints | ||
| resource/mongodbatlas_privatelink_endpoint_service_data_federation_online_archive: Adds support for import using `{project_id}/{endpoint_id}` format | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ```release-note:enhancement | ||
| resource/mongodbatlas_privatelink_endpoint_service_data_federation_online_archive: Adds Azure support, including `customer_endpoint_ip_address`, `azure_link_id`, `error_message`, and `status` | ||
| data-source/mongodbatlas_privatelink_endpoint_service_data_federation_online_archive: Adds Azure field support, including `customer_endpoint_ip_address`, `azure_link_id`, `error_message`, and `status` | ||
| data-source/mongodbatlas_privatelink_endpoint_service_data_federation_online_archives: Adds Azure field support, including `customer_endpoint_ip_address`, `azure_link_id`, `error_message`, and `status` | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,12 @@ on: | |
| required: true | ||
| mongodb_atlas_private_endpoint_dns_name: | ||
| required: true | ||
| mongodb_atlas_private_endpoint_id_replace: | ||
| required: true | ||
| mongodb_atlas_private_endpoint_id_azure: | ||
| required: true | ||
| mongodb_atlas_private_endpoint_ip_address_azure: | ||
| required: true | ||
| mongodb_atlas_gov_private_key: | ||
| required: true | ||
| mongodb_atlas_gov_public_key: | ||
|
|
@@ -315,7 +321,7 @@ jobs: | |
| - 'internal/serviceapi/customdbroleapi/*.go' | ||
| - 'internal/serviceapi/databaseuserapi/*.go' | ||
| - 'internal/serviceapi/maintenancewindowapi/*.go' | ||
| - 'internal/serviceapi/privatelinkendpointservicedatafederationonlinearchiveapi/*.go' | ||
| - 'internal/serviceapi/privatelinkendpointservicedatafederationonlinearchive/*.go' | ||
| - 'internal/serviceapi/projectapi/*.go' | ||
| - 'internal/serviceapi/projectsettingsapi/*.go' | ||
| - 'internal/serviceapi/resourcepolicyapi/*.go' | ||
|
|
@@ -678,6 +684,9 @@ jobs: | |
| AWS_KMS_KEY_ID: ${{ secrets.aws_kms_key_id }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_DNS_NAME: ${{ secrets.mongodb_atlas_private_endpoint_dns_name }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_ID: ${{ secrets.mongodb_atlas_private_endpoint_id }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_ID_REPLACE: ${{ secrets.mongodb_atlas_private_endpoint_id_replace }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_ID_AZURE: ${{ secrets.mongodb_atlas_private_endpoint_id_azure }} | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These variables are still not wired to the repo, however would like confirmation whether we have a pre-Azure setup that I can use for this, or use my own instead. Would prefer the first option as we might risk having the endpoint_id removed at some point.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see we have some azure resources used in our ci (
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep correct, got the info I needed doing a bit of digging and added the vars for the test |
||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_IP_ADDRESS_AZURE: ${{ secrets.mongodb_atlas_private_endpoint_ip_address_azure }} | ||
| AZURE_CLIENT_ID: ${{ secrets.azure_client_id }} | ||
| AZURE_APP_SECRET: ${{ secrets.azure_app_secret }} | ||
| AZURE_SUBSCRIPTION_ID: ${{ secrets.azure_subscription_id }} | ||
|
|
@@ -693,7 +702,7 @@ jobs: | |
| ./internal/serviceapi/databaseuserapi | ||
| ./internal/serviceapi/logintegration | ||
| ./internal/serviceapi/maintenancewindowapi | ||
| ./internal/serviceapi/privatelinkendpointservicedatafederationonlinearchiveapi | ||
| ./internal/serviceapi/privatelinkendpointservicedatafederationonlinearchive | ||
| ./internal/serviceapi/projectapi | ||
| ./internal/serviceapi/projectsettingsapi | ||
| ./internal/serviceapi/streamconnectionapi | ||
|
|
@@ -1231,7 +1240,9 @@ jobs: | |
| - name: Acceptance Tests | ||
| env: | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_ID: ${{ secrets.mongodb_atlas_private_endpoint_id }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_DNS_NAME: ${{ secrets.mongodb_atlas_private_endpoint_dns_name }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_DNS_NAME: ${{ secrets.mongodb_atlas_private_endpoint_dns_name }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_ID_AZURE: ${{ secrets.mongodb_atlas_private_endpoint_id_azure }} | ||
| MONGODB_ATLAS_PRIVATE_ENDPOINT_IP_ADDRESS_AZURE: ${{ secrets.mongodb_atlas_private_endpoint_ip_address_azure }} | ||
| AWS_ACCOUNT_ID: ${{ secrets.aws_account_id }} | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ subcategory: "Data Federation" | |
|
|
||
| -> **NOTE:** Updates are limited to the `comment` argument. | ||
|
|
||
| ## Example Usage | ||
| ## Example Usage: AWS provider | ||
|
|
||
| ```terraform | ||
|
|
||
|
|
@@ -44,18 +44,22 @@ The `service_name` value for the region in question can be found in the [MongoDB | |
|
|
||
| ## Argument Reference | ||
|
|
||
| * `project_id` (Required) - Unique 24-hexadecimal digit string that identifies your project. | ||
| * `endpoint_id` (Required) - Unique 22-character alphanumeric string that identifies the private endpoint. See [Atlas Data Federation supports Amazon Web Services private endpoints using the AWS PrivateLink feature](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Data-Federation/operation/createDataFederationPrivateEndpoint). | ||
| * `provider_name` (Required) - Human-readable label that identifies the cloud service provider. | ||
| * `project_id` (Required) - Unique 24-hexadecimal digit string that identifies your project. | ||
| * `endpoint_id` (Required) - Unique string that identifies the private endpoint. For AWS, this is a 22-character alphanumeric string (e.g. `vpce-xxxxxxxxxxxxxxxxx`). For Azure, this is the full resource ID of the private endpoint (e.g. `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}`). See [Atlas Data Federation supports AWS and Azure private endpoints using the PrivateLink feature](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Data-Federation/operation/createDataFederationPrivateEndpoint). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docs/resources/privatelink_endpoint_service_data_federation_online_archive.md:48 — Since Azure Severity: high 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 7c3d74a |
||
| * `provider_name` (Required) - Human-readable label that identifies the cloud service provider. AWS and Azure are currently supported. | ||
| * `timeouts` - (Optional) The duration to wait for the Private Endpoint Service resource for Data Federation and Online Archive to be created or deleted. The timeout value is specified in a signed sequence of decimal numbers followed by a time unit (e.g., `1h45m`, `300s`, `10m`). Valid units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. The default timeout values for the following operations are: `create` (default: `2h`), `delete` (default: `2h`). [Learn more about timeouts](https://www.terraform.io/plugin/sdkv2/resources/retries-and-customizable-timeouts). | ||
| * `region` - Human-readable label to identify the region of VPC endpoint. Requires the **Atlas region name**, see the reference list for [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). If defined, you must also specify a value for `customer_endpoint_dns_name`. | ||
| * `customer_endpoint_dns_name` - (Optional) Human-readable label to identify VPC endpoint DNS name. If defined, you must also specify a value for `region`. | ||
| * `region` - Human-readable label to identify the region of VPC endpoint. Requires the **Atlas region name**, see the reference list for [each provider](https://www.mongodb.com/docs/atlas/data-federation/adf-overview/regions/?cloud-provider=azure&interface=atlas-ui). For `AWS`, if defined, you must also specify a value for `customer_endpoint_dns_name`. | ||
| * `customer_endpoint_dns_name` - (Optional) Human-readable label to identify VPC endpoint DNS name in AWS. If defined, you must also specify a value for `region`. | ||
| * `customer_endpoint_ip_address`: (Optional) IP address used to connect the Azure private endpoint. | ||
| * `comment` - (Optional) Human-readable string to associate with this private endpoint. | ||
|
|
||
| ## Attributes Reference | ||
|
|
||
| In addition to all arguments above, the following attributes are exported: | ||
|
|
||
| * `azure_link_id` - Link ID that identifies the Azure private endpoint connection. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we missing data source doc adjustments?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, sorry about that. Addressed in 41835cf and will request another review to Docs team |
||
| * `error_message` - Error message describing a failure approving the private endpoint request. | ||
| * `status` - Status of the private endpoint connection request. | ||
| * `type` - Human-readable label that identifies the resource type associated with this private endpoint. | ||
|
|
||
| ## Import | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Example - PrivateLink for Data Federation and Online Archive (Azure) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. top level folder separate different resources. Currently find it confusing to nest within
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 77b58c8 |
||
|
|
||
| Set up a private connection to [Data Federation or Online Archive](https://www.mongodb.com/docs/atlas/data-federation/tutorial/config-private-endpoint/) using Azure Private Endpoint and MongoDB Atlas. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - Terraform `>= 1.0` | ||
| - An Azure account with permissions to create networking resources | ||
| - A MongoDB Atlas account with a service account credential pair | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. Authenticate to Azure: | ||
|
|
||
| ```bash | ||
| az login | ||
| ``` | ||
|
|
||
| 2. Export MongoDB Atlas credentials (or provide them in `terraform.tfvars`): | ||
|
|
||
| ```bash | ||
| export MONGODB_ATLAS_CLIENT_ID="<ATLAS_CLIENT_ID>" | ||
| export MONGODB_ATLAS_CLIENT_SECRET="<ATLAS_CLIENT_SECRET>" | ||
| ``` | ||
|
|
||
| 3. Create `terraform.tfvars` with at least: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. examples/.../README.md:26 — The “terraform.tfvars with at least” list omits the required Severity: medium 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
|
|
||
| ```hcl | ||
| atlas_client_id = "<ATLAS_CLIENT_ID>" | ||
| atlas_client_secret = "<ATLAS_CLIENT_SECRET>" | ||
| project_id = "<ATLAS_PROJECT_ID>" | ||
| azure_location = "East US 2" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we sure about this location format? Looks a bit strange to me, would expect
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep that was a mix of Atlas + Azure on my side 😂 var not needed so deleted it in 77b58c8 due to a bit of rework in the example |
||
| atlas_data_federation_private_link_service_resource_id = "<AZURE_RESOURCE_ID_OF_ATLAS_PRIVATE_LINK_SERVICE>" | ||
| ``` | ||
|
|
||
| Optional variables let you customize resource group, VNet, and subnet names/CIDRs. | ||
|
|
||
| 4. Initialize and review the plan: | ||
|
|
||
| ```bash | ||
| terraform init | ||
| terraform plan | ||
| ``` | ||
|
|
||
| 5. Apply: | ||
|
|
||
| ```bash | ||
| terraform apply | ||
| ``` | ||
|
|
||
| 6. Destroy when finished: | ||
|
|
||
| ```bash | ||
| terraform destroy | ||
| ``` | ||
|
|
||
| ## What This Example Creates | ||
|
|
||
| - Azure Resource Group, Virtual Network, and Subnet | ||
| - Azure `azurerm_private_endpoint` connected to the Atlas-managed Data Federation Private Link Service | ||
| - `mongodbatlas_privatelink_endpoint_service_data_federation_online_archive` | ||
| - Singular and plural data source reads for verification | ||
|
|
||
| ## Resource Dependency Chain | ||
|
|
||
| 1. `mongodbatlas_privatelink_endpoint` requires `project_id` and Atlas Azure region. | ||
| 2. `azurerm_private_endpoint` requires Atlas private link service metadata and Azure subnet. | ||
| 3. `mongodbatlas_privatelink_endpoint_service_data_federation_online_archive` requires: | ||
| - Azure private endpoint ID (`endpoint_id`) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| resource "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "this" { | ||
| project_id = var.project_id | ||
| endpoint_id = azurerm_private_endpoint.this.id | ||
| provider_name = "AZURE" | ||
| region = "US_EAST_2" | ||
| customer_endpoint_ip_address = azurerm_private_endpoint.this.private_service_connection[0].private_ip_address | ||
| comment = "Terraform Example Comment" | ||
| } | ||
|
|
||
| data "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "single" { | ||
| project_id = mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.this.project_id | ||
| endpoint_id = mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.this.endpoint_id | ||
|
|
||
| depends_on = [mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.this] | ||
| } | ||
|
|
||
| data "mongodbatlas_privatelink_endpoint_service_data_federation_online_archives" "list" { | ||
| project_id = var.project_id | ||
|
|
||
| depends_on = [mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.this] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| resource "azurerm_resource_group" "this" { | ||
| name = var.azure_resource_group_name | ||
| location = var.azure_location | ||
| } | ||
|
|
||
| resource "azurerm_virtual_network" "this" { | ||
| name = var.vnet_name | ||
| address_space = var.vnet_cidr | ||
| location = azurerm_resource_group.this.location | ||
| resource_group_name = azurerm_resource_group.this.name | ||
| } | ||
|
|
||
| resource "azurerm_subnet" "this" { | ||
| name = var.subnet_name | ||
| resource_group_name = azurerm_resource_group.this.name | ||
| virtual_network_name = azurerm_virtual_network.this.name | ||
| address_prefixes = var.subnet_cidr | ||
|
|
||
| private_endpoint_network_policies = "Disabled" | ||
| } | ||
|
|
||
| resource "azurerm_private_endpoint" "this" { | ||
| name = "pe-atlas-datafederation-onlinearchive" | ||
| location = azurerm_resource_group.this.location | ||
| resource_group_name = azurerm_resource_group.this.name | ||
| subnet_id = azurerm_subnet.this.id | ||
|
|
||
| private_service_connection { | ||
| name = "atlas-df-connection" | ||
| private_connection_resource_id = var.atlas_data_federation_private_link_service_resource_id | ||
| is_manual_connection = true | ||
| request_message = "Terraform example for Atlas Data Federation private endpoint" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| output "resource_endpoint_id" { | ||
| value = mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.this.endpoint_id | ||
| } | ||
|
|
||
| output "resource_provider_name" { | ||
| value = mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.this.provider_name | ||
| } | ||
|
|
||
| output "single_ds_endpoint_id" { | ||
| value = data.mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.single.endpoint_id | ||
| } | ||
|
|
||
| output "single_ds_provider_name" { | ||
| value = data.mongodbatlas_privatelink_endpoint_service_data_federation_online_archive.single.provider_name | ||
| } | ||
|
|
||
| output "list_ds_results_count" { | ||
| value = length(data.mongodbatlas_privatelink_endpoint_service_data_federation_online_archives.list.results) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| provider "mongodbatlas" { | ||
| client_id = var.atlas_client_id | ||
| client_secret = var.atlas_client_secret | ||
| } | ||
|
|
||
| provider "azurerm" { | ||
| features {} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| variable "atlas_client_id" { | ||
| description = "MongoDB Atlas Service Account Client ID" | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "atlas_client_secret" { | ||
| description = "MongoDB Atlas Service Account Client Secret" | ||
| type = string | ||
| sensitive = true | ||
| default = "" | ||
| } | ||
|
|
||
| variable "project_id" { | ||
| description = "Atlas project ID" | ||
| type = string | ||
| } | ||
|
|
||
| variable "azure_location" { | ||
| description = "Azure location for the resource group and networking resources." | ||
| type = string | ||
| default = "East US 2" | ||
| } | ||
|
|
||
| variable "azure_resource_group_name" { | ||
| description = "Azure resource group name for this example." | ||
| type = string | ||
| default = "mdb-atlas-df-oa-rg" | ||
| } | ||
|
|
||
| variable "vnet_name" { | ||
| description = "Azure virtual network name for this example." | ||
| type = string | ||
| default = "mdb-atlas-df-oa-vnet" | ||
| } | ||
|
|
||
| variable "vnet_cidr" { | ||
| description = "CIDR block for the Azure virtual network." | ||
| type = list(string) | ||
| default = ["10.0.0.0/16"] | ||
| } | ||
|
|
||
| variable "subnet_name" { | ||
| description = "Azure subnet name where the private endpoint is created." | ||
| type = string | ||
| default = "mdb-atlas-df-oa-subnet" | ||
| } | ||
|
|
||
| variable "subnet_cidr" { | ||
| description = "CIDR block for the Azure subnet." | ||
| type = list(string) | ||
| default = ["10.0.1.0/24"] | ||
| } | ||
|
|
||
| variable "atlas_data_federation_private_link_service_resource_id" { | ||
| description = "Azure Resource ID of the Atlas-managed Data Federation Private Link Service for your region. See https://www.mongodb.com/docs/atlas/data-federation/tutorial/config-private-endpoint/ to find the value for your region." | ||
| type = string | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| terraform { | ||
| required_version = ">= 1.0" | ||
| required_providers { | ||
| mongodbatlas = { | ||
| source = "mongodb/mongodbatlas" | ||
| } | ||
| azurerm = { | ||
| source = "hashicorp/azurerm" | ||
| version = "~> 3.0" | ||
| } | ||
| } | ||
| } |
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.
should be three different entries