Skip to content

Commit

Permalink
azurerm_mongo_cluster - remove the check logic for `administrator_p…
Browse files Browse the repository at this point in the history
…assword` (hashicorp#28215)

* azurerm_mongo_cluster - remove the check logic for administrator_password

* update tc

* add random provider

* update tc
  • Loading branch information
neil-yechenwei authored Dec 13, 2024
1 parent 36996bc commit 72d455c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions internal/acceptance/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ func (td TestData) externalProviders() map[string]resource.ExternalProvider {
VersionConstraint: "=2.47.0",
Source: "registry.terraform.io/hashicorp/azuread",
},
"random": {
VersionConstraint: "=3.6.3",
Source: "registry.terraform.io/hashicorp/random",
},
"time": {
VersionConstraint: "=0.9.1",
Source: "registry.terraform.io/hashicorp/time",
Expand Down
4 changes: 0 additions & 4 deletions internal/services/mongocluster/mongo_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,6 @@ func (r MongoClusterResource) CustomizeDiff() sdk.ResourceFunc {
return fmt.Errorf("`administrator_username` is required when `create_mode` is %s", string(mongoclusters.CreateModeDefault))
}

if state.AdministratorPassword == "" {
return fmt.Errorf("`administrator_password` is required when `create_mode` is %s", string(mongoclusters.CreateModeDefault))
}

if state.ComputeTier == "" {
return fmt.Errorf("`compute_tier` is required when `create_mode` is %s", string(mongoclusters.CreateModeDefault))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,19 @@ func (r MongoClusterResource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "random_password" "test" {
length = 8
numeric = true
upper = true
lower = true
}
resource "azurerm_mongo_cluster" "test" {
name = "acctest-mc%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
administrator_username = "adminTerraform"
administrator_password = "QAZwsx123"
administrator_password = random_password.test.result
shard_count = "1"
compute_tier = "Free"
high_availability_mode = "Disabled"
Expand Down

0 comments on commit 72d455c

Please sign in to comment.