Skip to content

Commit

Permalink
New Resource: azurerm_sql_failover_group (#3901)
Browse files Browse the repository at this point in the history
(fixes #2989)
  • Loading branch information
simongh authored and katbyte committed Aug 20, 2019
1 parent c00f5d8 commit a1483fd
Show file tree
Hide file tree
Showing 8 changed files with 880 additions and 0 deletions.
8 changes: 8 additions & 0 deletions azurerm/helpers/azure/mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func ValidateMsSqlDatabaseName(i interface{}, k string) (_ []string, errors []er
return nil, errors
}

func ValidateMsSqlFailoverGroupName(i interface{}, k string) (_ []string, errors []error) {
if m, regexErrs := validate.RegExHelper(i, k, `^[0-9a-z]([-0-9a-z]{0,61}[0-9a-z])?$`); !m {
errors = append(regexErrs, fmt.Errorf("%q can contain only lowercase letters, numbers, and '-', but can't start or end with '-'.", k))
}

return nil, errors
}

//Following characters and any control characters are not allowed for resource name '%,&,\\\\,?,/'.\"
//The name can not end with characters: '. '
//TODO: unsure about length, was able to deploy one at 120
Expand Down
1 change: 1 addition & 0 deletions azurerm/internal/services/mssql/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func BuildClient(o *common.ClientOptions) *Client {

ElasticPoolsClient := sql.NewElasticPoolsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ElasticPoolsClient.Client, o.ResourceManagerAuthorizer)

return &Client{
ElasticPoolsClient: &ElasticPoolsClient,
}
Expand Down
5 changes: 5 additions & 0 deletions azurerm/internal/services/sql/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Client struct {
DatabaseThreatDetectionPoliciesClient *sql.DatabaseThreatDetectionPoliciesClient
ElasticPoolsClient *sql.ElasticPoolsClient
FirewallRulesClient *sql.FirewallRulesClient
FailoverGroupsClient *sql.FailoverGroupsClient
ServersClient *sql.ServersClient
ServerAzureADAdministratorsClient *sql.ServerAzureADAdministratorsClient
VirtualNetworkRulesClient *sql.VirtualNetworkRulesClient
Expand All @@ -27,6 +28,9 @@ func BuildClient(o *common.ClientOptions) *Client {
ElasticPoolsClient := sql.NewElasticPoolsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ElasticPoolsClient.Client, o.ResourceManagerAuthorizer)

FailoverGroupsClient := sql.NewFailoverGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&FailoverGroupsClient.Client, o.ResourceManagerAuthorizer)

FirewallRulesClient := sql.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&FirewallRulesClient.Client, o.ResourceManagerAuthorizer)

Expand All @@ -43,6 +47,7 @@ func BuildClient(o *common.ClientOptions) *Client {
DatabasesClient: &DatabasesClient,
DatabaseThreatDetectionPoliciesClient: &DatabaseThreatDetectionPoliciesClient,
ElasticPoolsClient: &ElasticPoolsClient,
FailoverGroupsClient: &FailoverGroupsClient,
FirewallRulesClient: &FirewallRulesClient,
ServersClient: &ServersClient,
ServerAzureADAdministratorsClient: &ServerAzureADAdministratorsClient,
Expand Down
1 change: 1 addition & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_sql_active_directory_administrator": resourceArmSqlAdministrator(),
"azurerm_sql_database": resourceArmSqlDatabase(),
"azurerm_sql_elasticpool": resourceArmSqlElasticPool(),
"azurerm_sql_failover_group": resourceArmSqlFailoverGroup(),
"azurerm_sql_firewall_rule": resourceArmSqlFirewallRule(),
"azurerm_sql_server": resourceArmSqlServer(),
"azurerm_sql_virtual_network_rule": resourceArmSqlVirtualNetworkRule(),
Expand Down
Loading

0 comments on commit a1483fd

Please sign in to comment.