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: Adds mongodbatlas_flex_cluster resource and data sources #2816

Merged
merged 25 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dd472f5
use SDK dev-preview
oarbusi Oct 16, 2024
dd489fd
chore: Generate Flex Cluster file structure and resource schema (#2702)
oarbusi Oct 17, 2024
5d853e7
feat: Implements `mongodbatlas_flex_cluster` resource (#2716)
oarbusi Oct 21, 2024
37e07f2
chore: Enable mongodbatlas_flex_cluster test in CI (#2720)
cveticm Oct 22, 2024
11e7ba9
chore: Generate Flex Cluster data source file and schemas (#2725)
cveticm Oct 23, 2024
a8eb106
chore: Adds state transition logic to mongodbatlas_flex_cluster resou…
oarbusi Oct 23, 2024
727010e
chore: Update operation improvements for `mongodbatlas_flex_cluster` …
oarbusi Oct 28, 2024
6234ad6
test: Enable mongodbatlas_flex_cluster tests in QA environment (#2741)
oarbusi Oct 28, 2024
f037345
feat: Implements and tests `mongodbatlas_flex_cluster` data source (#…
cveticm Oct 29, 2024
5aa0d84
Adjusting default timeout of `flex_cluster` to 3 hours (#2757)
cveticm Oct 30, 2024
a762e89
chore: Rebase dev_branch onto master_branch (#2764)
cveticm Oct 31, 2024
4f39d7c
feat: Implements `mongodbatlas_flex_cluster` plural data source (#2767)
cveticm Nov 5, 2024
69e2df9
chore: Improvements to SDK version update (#2770)
cveticm Nov 6, 2024
01cd8f2
doc: Adds documentation and example for mongodbatlas_flex_cluster res…
oarbusi Nov 8, 2024
4529b81
deprecate: Deprecates Serverless functionality (#2742)
oarbusi Nov 11, 2024
f828c3e
doc: Adds migration guides to transition out of Serverless and Shared…
oarbusi Nov 21, 2024
052a4b1
chore: Removes mentions and examples of Serverless and Shared-tier in…
oarbusi Nov 22, 2024
2a1aec1
chore: Refactor tags attribute schema and conversion logic (#2788)
cveticm Nov 22, 2024
f2c44b3
Merge branch 'master' into CLOUDP-262066-flex-cluster-dev
oarbusi Nov 22, 2024
ed994ec
fix changelog entry
oarbusi Nov 22, 2024
390bb82
january or later for shared tier autoconversion
oarbusi Nov 22, 2024
48283ba
Merge branch 'master' into CLOUDP-262066-flex-cluster-dev
lantoli Nov 25, 2024
2e66575
auto-generate singular data source, temporarily with checks
lantoli Nov 25, 2024
61f7388
remove singular data source check
lantoli Nov 25, 2024
bb7f005
update Description in plural data source
lantoli Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2716.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
mongodbatlas_flex_cluster
```
3 changes: 3 additions & 0 deletions .changelog/2738.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-datasource
mongodbatlas_flex_cluster
```
39 changes: 39 additions & 0 deletions .changelog/2742.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
```release-note:note
resource/mongodbatlas_serverless_instance: Deprecates `continuous_backup_enabled` attribute
```

```release-note:note
resource/mongodbatlas_serverless_instance: Deprecates `auto_indexing` attribute
```

```release-note:note
data-source/mongodbatlas_serverless_instance: Deprecates `continuous_backup_enabled` attribute
```

```release-note:note
data-source/mongodbatlas_serverless_instance: Deprecates `auto_indexing` attribute
```

```release-note:note
data-source/mongodbatlas_serverless_instances: Deprecates `continuous_backup_enabled` attribute
```

```release-note:note
data-source/mongodbatlas_serverless_instances: Deprecates `auto_indexing` attribute
```

```release-note:note
resource/mongodbatlas_privatelink_endpoint_serverless: Deprecates resource
```

```release-note:note
resource/mongodbatlas_privatelink_endpoint_service_serverless: Deprecates resource
```

```release-note:note
data-source/mongodbatlas_privatelink_endpoint_service_serverless: Deprecates data source
```

```release-note:note
data-source/mongodbatlas_privatelink_endpoints_service_serverless: Deprecates data source
```
3 changes: 3 additions & 0 deletions .changelog/2767.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-datasource
mongodbatlas_flex_clusters
```
30 changes: 30 additions & 0 deletions .github/workflows/acceptance-tests-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ on:
azure_private_endpoint_region:
type: string
required: true
mongodb_atlas_flex_project_id:
type: string
required: true
secrets: # all secrets are passed explicitly in this workflow
mongodb_atlas_public_key:
required: true
Expand Down Expand Up @@ -213,6 +216,7 @@ jobs:
encryption: ${{ steps.filter.outputs.encryption == 'true' || env.mustTrigger == 'true' }}
event_trigger: ${{ steps.filter.outputs.event_trigger == 'true' || env.mustTrigger == 'true' }}
federated: ${{ steps.filter.outputs.federated == 'true' || env.mustTrigger == 'true' }}
flex_cluster: ${{ steps.filter.outputs.flex_cluster == 'true' || env.mustTrigger == 'true' }}
generic: ${{ steps.filter.outputs.generic == 'true' || env.mustTrigger == 'true' }}
global_cluster_config: ${{ steps.filter.outputs.global_cluster_config == 'true' || env.mustTrigger == 'true' }}
ldap: ${{ steps.filter.outputs.ldap == 'true' || env.mustTrigger == 'true' }}
Expand Down Expand Up @@ -278,6 +282,8 @@ jobs:
- 'internal/service/federatedsettingsidentityprovider/*.go'
- 'internal/service/federatedsettingsorgconfig/*.go'
- 'internal/service/federatedsettingsorgrolemapping/*.go'
flex_cluster:
- 'internal/service/flexcluster/*.go'
generic:
- 'internal/service/auditing/*.go'
- 'internal/service/backupcompliancepolicy/*.go'
Expand Down Expand Up @@ -654,6 +660,30 @@ jobs:
./internal/service/federatedsettingsorgrolemapping
run: make testacc

flex_cluster:
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.flex_cluster == 'true' || inputs.test_group == 'flex_cluster' }}
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ inputs.ref || github.ref }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
with:
go-version-file: 'go.mod'
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
with:
terraform_version: ${{ inputs.terraform_version }}
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
MONGODB_ATLAS_FLEX_PROJECT_ID: ${{ inputs.mongodb_atlas_flex_project_id }}
MONGODB_ATLAS_ENABLE_PREVIEW: "true"
ACCTEST_PACKAGES: ./internal/service/flexcluster
run: make testacc

generic:
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.generic == 'true' || inputs.test_group == 'generic' }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ jobs:
mongodb_atlas_enable_preview: ${{ vars.MONGODB_ATLAS_ENABLE_PREVIEW }}
azure_private_endpoint_region: ${{ vars.AZURE_PRIVATE_ENDPOINT_REGION }}
mongodb_atlas_rp_org_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_RP_ORG_ID_QA || vars.MONGODB_ATLAS_RP_ORG_ID_DEV }}
mongodb_atlas_flex_project_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FLEX_PROJECT_ID_QA || vars.MONGODB_ATLAS_FLEX_PROJECT_ID }}
4 changes: 2 additions & 2 deletions .github/workflows/update-tf-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- name: Update files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make update-tf-version-in-repository
- name: Verify Changed files
uses: tj-actions/verify-changed-files@530d86d0a237225c87beaa000750988f8965ee31
uses: tj-actions/verify-changed-files@54483a2138ca67989bc40785aa22faee8b085894
id: verify-changed-files
- name: Create PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
Expand Down
4 changes: 3 additions & 1 deletion docs/data-sources/advanced_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "mongodbatlas_advanced_cluster" "example" {
replication_specs {
region_configs {
electable_specs {
instance_size = "M5"
instance_size = "M0"
}
provider_name = "TENANT"
backing_provider_name = "AWS"
Expand All @@ -35,6 +35,8 @@ data "mongodbatlas_advanced_cluster" "example" {
}
```

**NOTE:** There can only be one M0 cluster per project.

## Example using latest sharding configurations with independent shard scaling in the cluster

```terraform
Expand Down
4 changes: 3 additions & 1 deletion docs/data-sources/advanced_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "mongodbatlas_advanced_cluster" "example" {
replication_specs {
region_configs {
electable_specs {
instance_size = "M5"
instance_size = "M0"
}
provider_name = "TENANT"
backing_provider_name = "AWS"
Expand All @@ -34,6 +34,8 @@ data "mongodbatlas_advanced_clusters" "example" {
}
```

**NOTE:** There can only be one M0 cluster per project.

## Example using latest sharding configurations with independent shard scaling in the cluster

```terraform
Expand Down
86 changes: 86 additions & 0 deletions docs/data-sources/flex_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Data Source: mongodbatlas_flex_cluster

`mongodbatlas_flex_cluster` describes a flex cluster.

## Example Usages
```terraform
resource "mongodbatlas_flex_cluster" "example-cluster" {
project_id = var.project_id
name = var.cluster_name
provider_settings = {
backing_provider_name = "AWS"
region_name = "US_EAST_1"
}
termination_protection_enabled = true
}

data "mongodbatlas_flex_cluster" "example-cluster" {
project_id = var.project_id
name = mongodbatlas_flex_cluster.example-cluster.name
}

data "mongodbatlas_flex_clusters" "example-clusters" {
project_id = var.project_id
}

output "mongodbatlas_flex_cluster" {
value = data.mongodbatlas_flex_cluster.example-cluster.name
}

output "mongodbatlas_flex_clusters_names" {
value = [for cluster in data.mongodbatlas_flex_clusters.example-clusters.results : cluster.name]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Human-readable label that identifies the flex cluster.
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.

**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.

### Read-Only

- `backup_settings` (Attributes) Flex backup configuration (see [below for nested schema](#nestedatt--backup_settings))
- `cluster_type` (String) Flex cluster topology.
- `connection_strings` (Attributes) Collection of Uniform Resource Locators that point to the MongoDB database. (see [below for nested schema](#nestedatt--connection_strings))
- `create_date` (String) Date and time when MongoDB Cloud created this instance. This parameter expresses its value in ISO 8601 format in UTC.
- `id` (String) Unique 24-hexadecimal digit string that identifies the instance.
- `mongo_db_version` (String) Version of MongoDB that the instance runs.
- `provider_settings` (Attributes) Group of cloud provider settings that configure the provisioned MongoDB flex cluster. (see [below for nested schema](#nestedatt--provider_settings))
- `state_name` (String) Human-readable label that indicates the current operating condition of this instance.
- `tags` (Map of String) Map that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the instance.
- `termination_protection_enabled` (Boolean) Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.
- `version_release_system` (String) Method by which the cluster maintains the MongoDB versions.

<a id="nestedatt--backup_settings"></a>
### Nested Schema for `backup_settings`

Read-Only:

- `enabled` (Boolean) Flag that indicates whether backups are performed for this flex cluster. Backup uses [TODO](TODO) for flex clusters.


<a id="nestedatt--connection_strings"></a>
### Nested Schema for `connection_strings`

Read-Only:

- `standard` (String) Public connection string that you can use to connect to this cluster. This connection string uses the mongodb:// protocol.
- `standard_srv` (String) Public connection string that you can use to connect to this flex cluster. This connection string uses the `mongodb+srv://` protocol.


<a id="nestedatt--provider_settings"></a>
### Nested Schema for `provider_settings`

Read-Only:

- `backing_provider_name` (String) Cloud service provider on which MongoDB Cloud provisioned the flex cluster.
- `disk_size_gb` (Number) Storage capacity available to the flex cluster expressed in gigabytes.
- `provider_name` (String) Human-readable label that identifies the cloud service provider.
- `region_name` (String) Human-readable label that identifies the geographic location of your MongoDB flex cluster. The region you choose can affect network latency for clients accessing your databases. For a complete list of region names, see [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).

For more information see: [MongoDB Atlas API - Flex Cluster](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Flex-Clusters/operation/getFlexCluster) Documentation.
96 changes: 96 additions & 0 deletions docs/data-sources/flex_clusters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Data Source: mongodbatlas_flex_clusters

`mongodbatlas_flex_clusters` returns all flex clusters in a project.

## Example Usages
```terraform
resource "mongodbatlas_flex_cluster" "example-cluster" {
project_id = var.project_id
name = var.cluster_name
provider_settings = {
backing_provider_name = "AWS"
region_name = "US_EAST_1"
}
termination_protection_enabled = true
}

data "mongodbatlas_flex_cluster" "example-cluster" {
project_id = var.project_id
name = mongodbatlas_flex_cluster.example-cluster.name
}

data "mongodbatlas_flex_clusters" "example-clusters" {
project_id = var.project_id
}

output "mongodbatlas_flex_cluster" {
value = data.mongodbatlas_flex_cluster.example-cluster.name
}

output "mongodbatlas_flex_clusters_names" {
value = [for cluster in data.mongodbatlas_flex_clusters.example-clusters.results : cluster.name]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.

**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.

### Read-Only

- `results` (Attributes List) List of returned documents that MongoDB Cloud provides when completing this request. (see [below for nested schema](#nestedatt--results))

<a id="nestedatt--results"></a>
### Nested Schema for `results`

Read-Only:

- `backup_settings` (Attributes) Flex backup configuration (see [below for nested schema](#nestedatt--results--backup_settings))
- `cluster_type` (String) Flex cluster topology.
- `connection_strings` (Attributes) Collection of Uniform Resource Locators that point to the MongoDB database. (see [below for nested schema](#nestedatt--results--connection_strings))
- `create_date` (String) Date and time when MongoDB Cloud created this instance. This parameter expresses its value in ISO 8601 format in UTC.
- `id` (String) Unique 24-hexadecimal digit string that identifies the instance.
- `mongo_db_version` (String) Version of MongoDB that the instance runs.
- `name` (String) Human-readable label that identifies the flex cluster.
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access.

**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
- `provider_settings` (Attributes) Group of cloud provider settings that configure the provisioned MongoDB flex cluster. (see [below for nested schema](#nestedatt--results--provider_settings))
- `state_name` (String) Human-readable label that indicates the current operating condition of this instance.
- `tags` (Map of String) Map that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the instance.
- `termination_protection_enabled` (Boolean) Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.
- `version_release_system` (String) Method by which the cluster maintains the MongoDB versions.

<a id="nestedatt--results--backup_settings"></a>
### Nested Schema for `results.backup_settings`

Read-Only:

- `enabled` (Boolean) Flag that indicates whether backups are performed for this flex cluster. Backup uses [TODO](TODO) for flex clusters.


<a id="nestedatt--results--connection_strings"></a>
### Nested Schema for `results.connection_strings`

Read-Only:

- `standard` (String) Public connection string that you can use to connect to this cluster. This connection string uses the mongodb:// protocol.
- `standard_srv` (String) Public connection string that you can use to connect to this flex cluster. This connection string uses the `mongodb+srv://` protocol.


<a id="nestedatt--results--provider_settings"></a>
### Nested Schema for `results.provider_settings`

Read-Only:

- `backing_provider_name` (String) Cloud service provider on which MongoDB Cloud provisioned the flex cluster.
- `disk_size_gb` (Number) Storage capacity available to the flex cluster expressed in gigabytes.
- `provider_name` (String) Human-readable label that identifies the cloud service provider.
- `region_name` (String) Human-readable label that identifies the geographic location of your MongoDB flex cluster. The region you choose can affect network latency for clients accessing your databases. For a complete list of region names, see [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).

For more information see: [MongoDB Atlas API - Flex Clusters](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Streams/operation/listFlexClusters) Documentation.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
subcategory: "Deprecated"
---

**WARNING:** This data source is deprecated and will be removed in March 2025. For more datails see [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide)

# Data Source: privatelink_endpoint_service_serverless

`privatelink_endpoint_service_serverless` provides a Serverless PrivateLink Endpoint Service resource.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
subcategory: "Deprecated"
---

**WARNING:** This data source is deprecated and will be removed in March 2025. For more datails see [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide)

# Data Source: privatelink_endpoints_service_serverless

`privatelink_endpoints_service_serverless` describes the list of all Serverless PrivateLink Endpoint Service resource.
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/serverless_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ Follow this example to [setup private connection to a serverless instance using
* `provider_settings_provider_name` - Cloud service provider that applies to the provisioned the serverless instance.
* `provider_settings_region_name` - Human-readable label that identifies the physical location of your MongoDB serverless instance. The region you choose can affect network latency for clients accessing your databases.
* `state_name` - Stage of deployment of this serverless instance when the resource made its request.
* `continuous_backup_enabled` - Flag that indicates whether the serverless instance uses Serverless Continuous Backup.
* `continuous_backup_enabled` - (Deprecated) Flag that indicates whether the serverless instance uses Serverless Continuous Backup.
* `termination_protection_enabled` - Flag that indicates whether termination protection is enabled on the cluster. If set to true, MongoDB Cloud won't delete the cluster. If set to false, MongoDB Cloud will delete the cluster.
* `auto_indexing` - Flag that indicates whether the serverless instance uses [Serverless Auto Indexing](https://www.mongodb.com/docs/atlas/performance-advisor/auto-index-serverless/).
* `auto_indexing` - (Deprecated) Flag that indicates whether the serverless instance uses [Serverless Auto Indexing](https://www.mongodb.com/docs/atlas/performance-advisor/auto-index-serverless/).
* `tags` - Set that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. See [below](#tags).

### Tags
Expand Down
Loading