Skip to content
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

mariadb_server: New attributes, flatten storage_profile block #6865

Merged
merged 4 commits into from
May 14, 2020
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
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.

Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading