Skip to content

Commit

Permalink
mariadb_server: New attributes, flatten storage_profile block (#6865)
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed May 14, 2020
1 parent 3b56e8b commit e671148
Show file tree
Hide file tree
Showing 18 changed files with 935 additions and 512 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,14 +3,14 @@ package mariadb
import (
"fmt"
"log"
"regexp"
"time"

"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"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/mariadb/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
Expand Down Expand Up @@ -43,13 +43,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
24 changes: 12 additions & 12 deletions azurerm/internal/services/mariadb/mariadb_database_resource.go
Expand Up @@ -12,9 +12,9 @@ import (
"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/services/mariadb/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
Expand Down Expand Up @@ -49,13 +49,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 +66,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,15 +3,18 @@ package mariadb
import (
"fmt"
"log"
"regexp"
"time"

"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"
"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/services/mariadb/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
Expand All @@ -35,10 +38,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 +53,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 e671148

Please sign in to comment.