Skip to content

Commit

Permalink
New attributes, flatten storage_profile block
Browse files Browse the repository at this point in the history
- `create_mode`, `creation_source_server_id`,
  `public_network_access_enabled`

- Support replicas and point-in-time restores

- Use booleans for toggle properties, renaming
  * `auto_grow` -> `auto_grow_enabled`
  * `geo_redundant_backup` -> `geo_redundant_backup_enabled`
  * `ssl_enforcement` -> `ssl_enforcement_enabled`

- Remove redundant `storage_profile` block and move all properties
  within to top level

- Remove unpopulated attribute `administrator_login_password` from
  `mariadb_server` data source

Fixes: #4296, #6521
Related: #6459
  • Loading branch information
manicminer committed May 12, 2020
1 parent a1ad233 commit 9eacecc
Show file tree
Hide file tree
Showing 16 changed files with 891 additions and 463 deletions.
23 changes: 0 additions & 23 deletions azurerm/helpers/validate/database.go

This file was deleted.

28 changes: 0 additions & 28 deletions azurerm/helpers/validate/mariadb.go

This file was deleted.

Expand Up @@ -3,9 +3,10 @@ package mariadb
import (
"fmt"
"log"
"regexp"
"time"

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/mariadb/validate"

"github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down Expand Up @@ -43,13 +44,10 @@ func resourceArmMariaDbConfiguration() *schema.Resource {
"resource_group_name": azure.SchemaResourceGroupName(),

"server_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(
regexp.MustCompile("^[-a-zA-Z0-9]{3,50}$"),
"server_name must be 3 - 50 characters long, and contain only letters, numbers and hyphens",
),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.MariaDbServerServerName,
},

"value": {
Expand Down
25 changes: 13 additions & 12 deletions azurerm/internal/services/mariadb/mariadb_database_resource.go
Expand Up @@ -6,13 +6,14 @@ import (
"regexp"
"time"

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/mariadb/validate"

"github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
Expand Down Expand Up @@ -49,13 +50,10 @@ func resourceArmMariaDbDatabase() *schema.Resource {
"resource_group_name": azure.SchemaResourceGroupName(),

"server_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(
regexp.MustCompile("^[-a-zA-Z0-9]{3,50}$"),
"server_name must be 3 - 50 characters long, and contain only letters, numbers and hyphens",
),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.MariaDbServerServerName,
},

"charset": {
Expand All @@ -69,10 +67,13 @@ func resourceArmMariaDbDatabase() *schema.Resource {
},

"collation": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.MariaDatabaseCollation,
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(
regexp.MustCompile("^[A-Za-z0-9_. ]+$"),
"collation must contain only alphanumeric, underscore, space and dot characters",
),
},
},
}
Expand Down
Expand Up @@ -3,13 +3,17 @@ package mariadb
import (
"fmt"
"log"
"regexp"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/mariadb/validate"

"github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
azValidate "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
Expand All @@ -35,10 +39,13 @@ func resourceArmMariaDBFirewallRule() *schema.Resource {

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.MariaDBFirewallRuleName,
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(
regexp.MustCompile("^[-a-z0-9]{1,128}$"),
"name must be 1-128 characters long and contain only letters, numbers and hyphens",
),
},

"resource_group_name": azure.SchemaResourceGroupName(),
Expand All @@ -47,19 +54,19 @@ func resourceArmMariaDBFirewallRule() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.MariaDBServerName,
ValidateFunc: validate.MariaDbServerServerName,
},

"start_ip_address": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validate.IPv4Address,
ValidateFunc: azValidate.IPv4Address,
},

"end_ip_address": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validate.IPv4Address,
ValidateFunc: azValidate.IPv4Address,
},
},
}
Expand Down
Expand Up @@ -46,12 +46,6 @@ func dataSourceMariaDbServer() *schema.Resource {
Computed: true,
},

"administrator_login_password": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},

"version": {
Type: schema.TypeString,
Computed: true,
Expand Down

0 comments on commit 9eacecc

Please sign in to comment.