Skip to content

feat: Update Resource Policy resource to GA #3276

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

Merged
merged 4 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .changelog/3276.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:note
resource/mongodbatlas_resource_policy: Enables usage without preview environment flag
```

```release-note:note
data-source/mongodbatlas_resource_policy: Enables usage without preview environment flag
```

```release-note:note
data-source/mongodbatlas_resource_policies: Enables usage without preview environment flag
```
1 change: 0 additions & 1 deletion .github/workflows/acceptance-tests-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,6 @@ jobs:
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.mongodb_atlas_rp_public_key }}
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.mongodb_atlas_rp_private_key }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
MONGODB_ATLAS_ENABLE_PREVIEW: "true"
Copy link
Member

Choose a reason for hiding this comment

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

so it's not used anywhere anymore?

ACCTEST_PACKAGES: |
./internal/service/resourcepolicy
run: make testacc
Expand Down
4 changes: 0 additions & 4 deletions docs/data-sources/resource_policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

`mongodbatlas_resource_policies` returns all resource policies in an organization.

-> **NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](https://github.com/mongodb/terraform-provider-mongodbatlas?tab=readme-ov-file#preview-features) when running `terraform` commands.

## Example Usages
```terraform
resource "mongodbatlas_resource_policy" "project_ip_access_list" {
Expand Down
4 changes: 0 additions & 4 deletions docs/data-sources/resource_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

`mongodbatlas_resource_policy` describes a resource policy in an organization.

-> **NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](https://github.com/mongodb/terraform-provider-mongodbatlas?tab=readme-ov-file#preview-features) when running `terraform` commands.

## Example Usages
```terraform
resource "mongodbatlas_resource_policy" "project_ip_access_list" {
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/resource_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

`mongodbatlas_resource_policy` provides a Resource Policy resource. The resource lets you create, edit and delete resource policies to prevent misconfigurations and reduce the need for corrective interventions in your organization.

-> **NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](https://github.com/mongodb/terraform-provider-mongodbatlas?tab=readme-ov-file#preview-features) when running `terraform` commands.


## Example Usages

Expand Down
5 changes: 0 additions & 5 deletions examples/mongodbatlas_resource_policy/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# MongoDB Atlas Provider -- Atlas Resource Policy
This example creates three different resource policies in an organization.

**NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](../../README.md#preview-features) when running `terraform` commands.


Variables Required to be set:
- `public_key`: Atlas public key
- `private_key`: Atlas private key
Expand Down
12 changes: 5 additions & 7 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,13 @@ func (p *MongodbtlasProvider) DataSources(context.Context) []func() datasource.D
flexsnapshot.PluralDataSource,
flexrestorejob.DataSource,
flexrestorejob.PluralDataSource,
resourcepolicy.DataSource,
resourcepolicy.PluralDataSource,
}
if config.PreviewProviderV2AdvancedCluster() {
dataSources = append(dataSources, advancedclustertpf.DataSource, advancedclustertpf.PluralDataSource)
}
previewDataSources := []func() datasource.DataSource{
resourcepolicy.DataSource,
resourcepolicy.PluralDataSource,
} // Data sources not yet in GA
previewDataSources := []func() datasource.DataSource{} // Data sources not yet in GA
Copy link
Member

@lantoli lantoli Apr 14, 2025

Choose a reason for hiding this comment

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

can we also delete providerEnablePreview, providerEnablePreview and any other supporting code that is not needed anymore?

edit: it can be done in CLOUDP-282801

if providerEnablePreview {
dataSources = append(dataSources, previewDataSources...)
}
Expand All @@ -486,13 +485,12 @@ func (p *MongodbtlasProvider) Resources(context.Context) []func() resource.Resou
mongodbemployeeaccessgrant.Resource,
streamprivatelinkendpoint.Resource,
flexcluster.Resource,
resourcepolicy.Resource,
}
if config.PreviewProviderV2AdvancedCluster() {
resources = append(resources, advancedclustertpf.Resource)
}
previewResources := []func() resource.Resource{
resourcepolicy.Resource,
} // Resources not yet in GA
previewResources := []func() resource.Resource{} // Resources not yet in GA
if providerEnablePreview {
resources = append(resources, previewResources...)
}
Expand Down
4 changes: 0 additions & 4 deletions templates/data-sources/resource_policies.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

`{{.Name}}` returns all resource policies in an organization.

-> **NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](https://github.com/mongodb/terraform-provider-mongodbatlas?tab=readme-ov-file#preview-features) when running `terraform` commands.

## Example Usages
{{ tffile (printf "examples/mongodbatlas_resource_policy/main.tf" )}}

Expand Down
4 changes: 0 additions & 4 deletions templates/data-sources/resource_policy.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

`{{.Name}}` describes a resource policy in an organization.

-> **NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](https://github.com/mongodb/terraform-provider-mongodbatlas?tab=readme-ov-file#preview-features) when running `terraform` commands.

## Example Usages
{{ tffile (printf "examples/%s/main.tf" .Name )}}

Expand Down
4 changes: 0 additions & 4 deletions templates/resources/resource_policy.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

`{{.Name}}` provides a Resource Policy resource. The resource lets you create, edit and delete resource policies to prevent misconfigurations and reduce the need for corrective interventions in your organization.

-> **NOTE**: Resource Policies are currently in Public Preview. To use this feature, you must take the following actions:
1. Enable the `Atlas Resource Policies` Preview Feature in your organization (contact [MongoDB Support](https://www.mongodb.com/services/support)).
2. Enable the [Preview Features](https://github.com/mongodb/terraform-provider-mongodbatlas?tab=readme-ov-file#preview-features) when running `terraform` commands.


## Example Usages

Expand Down