Skip to content

Commit 560c2e8

Browse files
chore: Removes all usages of MONGODB_ATLAS_ENABLE_PREVIEW (#3285)
* Remove all docs and usage of MONGODB_ATLAS_ENABLE_PREVIEW * skip resource policy mig test until 1.33.0 * formating
1 parent 6a1cb72 commit 560c2e8

File tree

10 files changed

+9
-58
lines changed

10 files changed

+9
-58
lines changed

.github/workflows/acceptance-tests-runner.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ on:
9494
mongodb_atlas_project_ear_pe_id:
9595
type: string
9696
required: true
97-
mongodb_atlas_enable_preview:
98-
type: string
99-
required: true
10097
azure_private_endpoint_region:
10198
type: string
10299
required: true
@@ -661,7 +658,6 @@ jobs:
661658
AZURE_KEY_IDENTIFIER: ${{ secrets.azure_key_identifier }}
662659
AZURE_KEY_VAULT_NAME_UPDATED: ${{ secrets.azure_key_vault_name_updated }}
663660
AZURE_KEY_IDENTIFIER_UPDATED: ${{ secrets.azure_key_identifier_updated }}
664-
MONGODB_ATLAS_ENABLE_PREVIEW: ${{ inputs.mongodb_atlas_enable_preview }}
665661
AWS_REGION: ${{ vars.AWS_REGION_LOWERCASE }}
666662
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
667663
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}

.github/workflows/acceptance-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ jobs:
125125
mongodb_atlas_project_ear_pe_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_PROJECT_EAR_PE_ID_QA || vars.MONGODB_ATLAS_PROJECT_EAR_PE_ID_DEV }}
126126
mongodb_atlas_project_ear_pe_aws_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_PROJECT_EAR_PE_AWS_ID_QA || vars.MONGODB_ATLAS_PROJECT_EAR_PE_AWS_ID_DEV }}
127127
aws_ear_role_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.AWS_EAR_ROLE_ID_QA || vars.AWS_EAR_ROLE_ID_DEV }}
128-
mongodb_atlas_enable_preview: ${{ vars.MONGODB_ATLAS_ENABLE_PREVIEW }}
129128
azure_private_endpoint_region: ${{ vars.AZURE_PRIVATE_ENDPOINT_REGION }}
130129
mongodb_atlas_rp_org_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_RP_ORG_ID_QA || vars.MONGODB_ATLAS_RP_ORG_ID_DEV }}
131130
confluent_cloud_network_id: ${{ vars.CONFLUENT_CLOUD_NETWORK_ID }}

.github/workflows/examples.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010

1111
env:
1212
AWS_DEFAULT_REGION: us-west-2
13-
MONGODB_ATLAS_ENABLE_PREVIEW: "true"
1413

1514
jobs:
1615
tf-validate:

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ To use a released provider in your Terraform environment, run [`terraform init`]
2727

2828
Documentation about the provider specific configuration options can be found on the [provider's website](https://www.terraform.io/docs/providers/).
2929

30-
## Preview Features
31-
In order to use and/or test preview resources and datasources in this provider you'll need to set the environment variable `MONGODB_ATLAS_ENABLE_PREVIEW` to true.
32-
33-
34-
```bash
35-
export MONGODB_ATLAS_ENABLE_PREVIEW=true
36-
```
3730
## Logs
3831
To help with issues, you can turn on Logs with `export TF_LOG=TRACE`. Note: this is very noisy.
3932

internal/provider/provider.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"log"
66
"os"
77
"regexp"
8-
"strconv"
98
"time"
109

1110
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
@@ -50,10 +49,6 @@ import (
5049
"github.com/mongodb/terraform-provider-mongodbatlas/version"
5150
)
5251

53-
var (
54-
providerEnablePreview, _ = strconv.ParseBool(os.Getenv("MONGODB_ATLAS_ENABLE_PREVIEW"))
55-
)
56-
5752
const (
5853
MongodbGovCloudURL = "https://cloud.mongodbgov.com"
5954
MongodbGovCloudQAURL = "https://cloud-qa.mongodbgov.com"
@@ -462,10 +457,6 @@ func (p *MongodbtlasProvider) DataSources(context.Context) []func() datasource.D
462457
if config.PreviewProviderV2AdvancedCluster() {
463458
dataSources = append(dataSources, advancedclustertpf.DataSource, advancedclustertpf.PluralDataSource)
464459
}
465-
previewDataSources := []func() datasource.DataSource{} // Data sources not yet in GA
466-
if providerEnablePreview {
467-
dataSources = append(dataSources, previewDataSources...)
468-
}
469460
return dataSources
470461
}
471462

@@ -490,10 +481,6 @@ func (p *MongodbtlasProvider) Resources(context.Context) []func() resource.Resou
490481
if config.PreviewProviderV2AdvancedCluster() {
491482
resources = append(resources, advancedclustertpf.Resource)
492483
}
493-
previewResources := []func() resource.Resource{} // Resources not yet in GA
494-
if providerEnablePreview {
495-
resources = append(resources, previewResources...)
496-
}
497484
return resources
498485
}
499486

internal/service/resourcepolicy/resource_migration_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import (
77
)
88

99
func TestMigResourcePolicy_basic(t *testing.T) {
10-
mig.SkipIfVersionBelow(t, "1.22.0") // this feature was introduced in provider version 1.21.0, plural data source schema was changed in 1.22.0
11-
12-
var description *string
13-
if mig.IsProviderVersionAtLeast("1.32.0") {
14-
description = descriptionPtr
15-
}
16-
17-
mig.CreateAndRunTestNonParallel(t, basicTestCase(t, description))
10+
mig.SkipIfVersionBelow(t, "1.33.0") // this feature was GA (no need of MONGODB_ATLAS_ENABLE_PREVIEW env variable) in 1.33.0
11+
mig.CreateAndRunTestNonParallel(t, basicTestCase(t))
1812
}

internal/service/resourcepolicy/resource_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1111
"github.com/hashicorp/terraform-plugin-testing/terraform"
1212

13-
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion"
1413
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc"
1514
)
1615

@@ -52,33 +51,31 @@ var (
5251
when {
5352
context.project.ipAccessList.contains(ip("0.0.0.0/0"))
5453
};`
55-
descriptionPtr = conversion.StringPtr("test-description")
54+
description = "test-description"
5655
)
5756

5857
func TestAccResourcePolicy_basic(t *testing.T) {
59-
tc := basicTestCase(t, descriptionPtr)
58+
tc := basicTestCase(t)
6059
resource.Test(t, *tc)
6160
}
6261

63-
func basicTestCase(t *testing.T, description *string) *resource.TestCase {
62+
func basicTestCase(t *testing.T) *resource.TestCase {
6463
t.Helper()
6564
var (
6665
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
6766
policyName = "test-policy"
6867
updatedName = "updated-policy"
6968
)
70-
var updatedDescription string
71-
if description != nil {
72-
updatedDescription = fmt.Sprintf("updated-%s", *description)
73-
}
69+
updatedDescription := fmt.Sprintf("updated-%s", description)
70+
7471
return &resource.TestCase{ // Need sequential execution for assertions to be deterministic (plural data source)
7572
PreCheck: func() { acc.PreCheckBasic(t) },
7673
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
7774
CheckDestroy: checkDestroy,
7875
Steps: []resource.TestStep{
7976
{
80-
Config: configBasic(orgID, policyName, description),
81-
Check: checksResourcePolicy(orgID, policyName, description, 1),
77+
Config: configBasic(orgID, policyName, &description),
78+
Check: checksResourcePolicy(orgID, policyName, &description, 1),
8279
},
8380
{
8481
Config: configBasic(orgID, updatedName, nil),

internal/testutil/acc/pre_check.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ func PreCheckCert(tb testing.TB) {
7474
}
7575
}
7676

77-
// PreCheckPreviewFlag is used for resources not yet in GA
78-
func PreCheckPreviewFlag(tb testing.TB) {
79-
tb.Helper()
80-
if os.Getenv("MONGODB_ATLAS_ENABLE_PREVIEW") == "" {
81-
tb.Fatal("`MONGODB_ATLAS_ENABLE_PREVIEW` must be set for running this acceptance test")
82-
}
83-
}
84-
8577
func PreCheckCloudProviderAccessAzure(tb testing.TB) {
8678
tb.Helper()
8779
PreCheckBasic(tb)

scripts/generate-doc.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ if [ ! -f "${TEMPLATE_FOLDER_PATH}/data-sources/${resource_name}s.md.tmpl" ]; th
6767
printf "Skipping this check: We assume that the resource does not have a plural data source.\n\n"
6868
fi
6969

70-
# ensure preview resource and data sources are also included during generation
71-
export MONGODB_ATLAS_ENABLE_PREVIEW="true"
72-
7370
trap 'rm -R docs-out/' EXIT # temp dir cleanup when script exits
7471

7572
tfplugindocs generate --tf-version "${TF_VERSION}" --website-source-dir "${TEMPLATE_FOLDER_PATH}" --rendered-website-dir "docs-out"

scripts/generate-docs-all.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ set -euo pipefail
2929
TF_VERSION="${TF_VERSION:-"1.11.4"}" # TF version to use when running tfplugindocs. Default: 1.11.4
3030
TEMPLATE_FOLDER_PATH="${TEMPLATE_FOLDER_PATH:-"templates"}" # PATH to the templates folder. Default: templates
3131

32-
# ensure preview resource and data sources are also included during generation
33-
export MONGODB_ATLAS_ENABLE_PREVIEW="true"
34-
3532
trap 'rm -R docs-out/' EXIT # temp dir cleanup when script exits
3633

3734
tfplugindocs generate --tf-version "${TF_VERSION}" --website-source-dir "${TEMPLATE_FOLDER_PATH}" --rendered-website-dir "docs-out" --provider-name "mongodbatlas"

0 commit comments

Comments
 (0)