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

add enable_tcp_reset to azurerm_lb_rule & azurerm_lb_nat_rule #5373

Merged
merged 3 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func resourceArmAutomationCredential() *schema.Resource {
"automation_account_name": {
Type: schema.TypeString,
Optional: true, //todo change to required once account_name has been removed
Computed: true, //todo remove once account_name has been removed
Computed: true, // todo remove once account_name has been removed
ForceNew: true,
ConflictsWith: []string{"account_name"}, //todo remove once account_name has been removed
ConflictsWith: []string{"account_name"}, // todo remove once account_name has been removed
ValidateFunc: azure.ValidateAutomationAccountName(),
},

Expand Down Expand Up @@ -90,7 +90,7 @@ func resourceArmAutomationCredentialCreateUpdate(d *schema.ResourceData, meta in

name := d.Get("name").(string)
resGroup := d.Get("resource_group_name").(string)
//todo remove this once `account_name` is removed
// todo remove this once `account_name` is removed
accountName := ""
if v, ok := d.GetOk("automation_account_name"); ok {
accountName = v.(string)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func resourceArmAutomationScheduleCreateUpdate(d *schema.ResourceData, meta inte
name := d.Get("name").(string)
resGroup := d.Get("resource_group_name").(string)
//CustomizeDiff should ensure one of these two is set
//todo remove this once `account_name` is removed
// todo remove this once `account_name` is removed
accountName := ""
if v, ok := d.GetOk("automation_account_name"); ok {
accountName = v.(string)
Expand Down Expand Up @@ -344,7 +344,7 @@ func resourceArmAutomationScheduleRead(d *schema.ResourceData, meta interface{})
d.Set("name", resp.Name)
d.Set("resource_group_name", resGroup)
d.Set("automation_account_name", accountName)
d.Set("account_name", accountName) //todo remove once `account_name` is removed
d.Set("account_name", accountName) // todo remove once `account_name` is removed
d.Set("frequency", string(resp.Frequency))

if v := resp.StartTime; v != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ func expandAzureRmCosmosDBAccountGeoLocations(databaseName string, d *schema.Res
return locations, nil
}

//todo remove when deprecated field `failover_policy` is
// todo remove when deprecated field `failover_policy` is
func expandAzureRmCosmosDBAccountFailoverPolicy(databaseName string, d *schema.ResourceData) ([]documentdb.Location, error) {
input := d.Get("failover_policy").(*schema.Set).List()
locations := make([]documentdb.Location, 0, len(input))
Expand Down Expand Up @@ -978,7 +978,7 @@ func flattenAzureRmCosmosDBAccountConsistencyPolicy(policy *documentdb.Consisten
return []interface{}{result}
}

//todo remove when failover_policy field is removed
// todo remove when failover_policy field is removed
func flattenAzureRmCosmosDBAccountFailoverPolicy(list *[]documentdb.FailoverPolicy) *schema.Set {
results := schema.Set{
F: resourceAzureRMCosmosDBAccountFailoverPolicyHash,
Expand Down Expand Up @@ -1064,7 +1064,7 @@ func flattenAzureRmCosmosDBAccountVirtualNetworkRules(rules *[]documentdb.Virtua
return &results
}

//todo remove once deprecated field `failover_policy` is removed
// todo remove once deprecated field `failover_policy` is removed
func resourceAzureRMCosmosDBAccountFailoverPolicyHash(v interface{}) int {
var buf bytes.Buffer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func dataSourceArmKeyVaultKey() *schema.Resource {
ConflictsWith: []string{"vault_uri"},
},

//todo remove in 2.0
// todo remove in 2.0
"vault_uri": {
Type: schema.TypeString,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func dataSourceArmKeyVaultSecret() *schema.Resource {
ConflictsWith: []string{"vault_uri"},
},

//todo remove in 2.0
// todo remove in 2.0
"vault_uri": {
Type: schema.TypeString,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func resourceArmKeyVaultAccessPolicy() *schema.Resource {
ConflictsWith: []string{"vault_name"},
},

//todo remove in 2.0
// todo remove in 2.0
"vault_name": {
Type: schema.TypeString,
Optional: true,
Expand All @@ -58,7 +58,7 @@ func resourceArmKeyVaultAccessPolicy() *schema.Resource {
ConflictsWith: []string{"key_vault_id"},
},

//todo remove in 2.0
// todo remove in 2.0
"resource_group_name": {
Type: schema.TypeString,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func resourceArmKeyVaultCertificate() *schema.Resource {
ConflictsWith: []string{"vault_uri"},
},

//todo remove in 2.0
// todo remove in 2.0
"vault_uri": {
Type: schema.TypeString,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func resourceArmKeyVaultKey() *schema.Resource {
ConflictsWith: []string{"vault_uri"},
},

//todo remove in 2.0
// todo remove in 2.0
"vault_uri": {
Type: schema.TypeString,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func resourceArmKeyVaultSecret() *schema.Resource {
ConflictsWith: []string{"vault_uri"},
},

//todo remove in 2.0
// todo remove in 2.0
"vault_uri": {
Type: schema.TypeString,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func resourceArmMsSqlElasticPoolRead(d *schema.ResourceData, meta interface{}) e
}
d.Set("zone_redundant", properties.ZoneRedundant)

//todo remove in 2.0
// todo remove in 2.0
if err := d.Set("elastic_pool_properties", flattenAzureRmMsSqlElasticPoolProperties(resp.ElasticPoolProperties)); err != nil {
return fmt.Errorf("Error setting `elastic_pool_properties`: %+v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func dataSourceArmVnetRead(d *schema.ResourceData, meta interface{}) error {

if props := resp.VirtualNetworkPropertiesFormat; props != nil {
if as := props.AddressSpace; as != nil {
if err := d.Set("address_spaces", utils.FlattenStringSlice(as.AddressPrefixes)); err != nil { //todo remove in 2.0
if err := d.Set("address_spaces", utils.FlattenStringSlice(as.AddressPrefixes)); err != nil { // todo remove in 2.0
return fmt.Errorf("error setting `address_spaces`: %v", err)
}
if err := d.Set("address_space", utils.FlattenStringSlice(as.AddressPrefixes)); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ func resourceArmLoadBalancerNatRule() *schema.Resource {
}, true),
},

"enable_floating_ip": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},

"frontend_port": {
Type: schema.TypeInt,
Required: true,
Expand All @@ -93,6 +87,24 @@ func resourceArmLoadBalancerNatRule() *schema.Resource {
ValidateFunc: validate.NoEmptyStrings,
},

"enable_floating_ip": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},

"enable_tcp_reset": {
Type: schema.TypeBool,
Optional: true,
},

"idle_timeout_in_minutes": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
tombuildsstuff marked this conversation as resolved.
Show resolved Hide resolved
ValidateFunc: validation.IntBetween(4, 30),
},

"frontend_ip_configuration_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -217,6 +229,8 @@ func resourceArmLoadBalancerNatRuleRead(d *schema.ResourceData, meta interface{}
d.Set("frontend_port", props.FrontendPort)
d.Set("backend_port", props.BackendPort)
d.Set("enable_floating_ip", props.EnableFloatingIP)
d.Set("enable_tcp_reset", props.EnableTCPReset)
d.Set("idle_timeout_in_minutes", props.IdleTimeoutInMinutes)

if ipconfiguration := props.FrontendIPConfiguration; ipconfiguration != nil {
fipID, err := azure.ParseAzureResourceID(*ipconfiguration.ID)
Expand Down Expand Up @@ -290,15 +304,20 @@ func resourceArmLoadBalancerNatRuleDelete(d *schema.ResourceData, meta interface

func expandAzureRmLoadBalancerNatRule(d *schema.ResourceData, lb *network.LoadBalancer) (*network.InboundNatRule, error) {
properties := network.InboundNatRulePropertiesFormat{
Protocol: network.TransportProtocol(d.Get("protocol").(string)),
FrontendPort: utils.Int32(int32(d.Get("frontend_port").(int))),
BackendPort: utils.Int32(int32(d.Get("backend_port").(int))),
Protocol: network.TransportProtocol(d.Get("protocol").(string)),
FrontendPort: utils.Int32(int32(d.Get("frontend_port").(int))),
BackendPort: utils.Int32(int32(d.Get("backend_port").(int))),
EnableTCPReset: utils.Bool(d.Get("enable_tcp_reset").(bool)),
}

if v, ok := d.GetOk("enable_floating_ip"); ok {
properties.EnableFloatingIP = utils.Bool(v.(bool))
}

if v, ok := d.GetOk("idle_timeout_in_minutes"); ok {
properties.IdleTimeoutInMinutes = utils.Int32(int32(v.(int)))
}

if v := d.Get("frontend_ip_configuration_name").(string); v != "" {
rule, exists := FindLoadBalancerFrontEndIpConfigurationByName(lb, v)
if !exists {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ func resourceArmLoadBalancerRule() *schema.Resource {
Default: false,
},

"enable_tcp_reset": {
Type: schema.TypeBool,
Optional: true,
},

"disable_outbound_snat": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -241,14 +246,9 @@ func resourceArmLoadBalancerRuleRead(d *schema.ResourceData, meta interface{}) e
d.Set("frontend_port", properties.FrontendPort)
d.Set("backend_port", properties.BackendPort)
d.Set("disable_outbound_snat", properties.DisableOutboundSnat)

if properties.EnableFloatingIP != nil {
d.Set("enable_floating_ip", properties.EnableFloatingIP)
}

if properties.IdleTimeoutInMinutes != nil {
d.Set("idle_timeout_in_minutes", properties.IdleTimeoutInMinutes)
}
d.Set("enable_floating_ip", properties.EnableFloatingIP)
d.Set("enable_tcp_reset", properties.EnableTCPReset)
d.Set("idle_timeout_in_minutes", properties.IdleTimeoutInMinutes)

if properties.FrontendIPConfiguration != nil {
fipID, err := azure.ParseAzureResourceID(*properties.FrontendIPConfiguration.ID)
Expand Down Expand Up @@ -334,6 +334,7 @@ func expandAzureRmLoadBalancerRule(d *schema.ResourceData, lb *network.LoadBalan
FrontendPort: utils.Int32(int32(d.Get("frontend_port").(int))),
BackendPort: utils.Int32(int32(d.Get("backend_port").(int))),
EnableFloatingIP: utils.Bool(d.Get("enable_floating_ip").(bool)),
EnableTCPReset: utils.Bool(d.Get("enable_tcp_reset").(bool)),
DisableOutboundSnat: utils.Bool(d.Get("disable_outbound_snat").(bool)),
}

Expand Down
Loading