Manages a Firewall Rule for a MySQL Server.
resource "azurerm_resource_group" "example" {
name = "api-rg-pro"
location = "West Europe"
}
resource "azurerm_mysql_server" "example" {
name = "example"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
version = "5.7"
sku_name = "GP_Gen5_2"
ssl_enforcement_enabled = true
}
resource "azurerm_mysql_firewall_rule" "example" {
name = "office"
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mysql_server.example.name
start_ip_address = "40.112.8.12"
end_ip_address = "40.112.8.12"
}
resource "azurerm_resource_group" "example" {
name = "api-rg-pro"
location = "West Europe"
}
resource "azurerm_mysql_server" "example" {
# ...
}
resource "azurerm_mysql_firewall_rule" "example" {
name = "office"
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mysql_server.example.name
start_ip_address = "40.112.0.0"
end_ip_address = "40.112.255.255"
}
resource "azurerm_resource_group" "example" {
name = "api-rg-pro"
location = "West Europe"
}
resource "azurerm_mysql_server" "example" {
# ...
}
resource "azurerm_mysql_firewall_rule" "example" {
name = "office"
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mysql_server.example.name
start_ip_address = "0.0.0.0"
end_ip_address = "0.0.0.0"
}
The following arguments are supported:
name
- (Required) Specifies the name of the MySQL Firewall Rule. Changing this forces a new resource to be created.
server_name
- (Required) Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
resource_group_name
- (Required) The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
start_ip_address
- (Required) Specifies the Start IP Address associated with this Firewall Rule.
end_ip_address
- (Required) Specifies the End IP Address associated with this Firewall Rule.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the MySQL Firewall Rule.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the MySQL Firewall Rule.update
- (Defaults to 30 minutes) Used when updating the MySQL Firewall Rule.read
- (Defaults to 5 minutes) Used when retrieving the MySQL Firewall Rule.delete
- (Defaults to 30 minutes) Used when deleting the MySQL Firewall Rule.MySQL Firewall Rule's can be imported using the resource id
, e.g.
terraform import azurerm_mysql_firewall_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/rule1