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

New Resource: azurerm_sql_failover_group #3901

Merged
merged 12 commits into from
Aug 20, 2019
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 @@ -360,6 +360,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