-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
added azurerm_lb_rule data source for #8271 #8365
added azurerm_lb_rule data source for #8271 #8365
Conversation
c4a629f
to
0ac3ff4
Compare
0ac3ff4
to
3ca258f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alvintang Thanks for this contribution. This is looking great, just a few minor comments and suggestions.
|
||
func dataSourceArmLoadBalancerRule() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceArmLoadBalancerLoadBalancingRulesRead, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: I think we can shorten this to dataSourceArmLoadBalancerRuleRead
(also singular name)
ValidateFunc: ValidateArmLoadBalancerRuleName, | ||
}, | ||
|
||
"resource_group_name": azure.SchemaResourceGroupName(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use SchemaResourceGroupNameForDataSource()
for data sources (doesn't set ForceNew)
"resource_group_name": azure.SchemaResourceGroupName(), | |
"resource_group_name": azure.SchemaResourceGroupNameForDataSource(), |
return fmt.Errorf("Load Balancer Rule %q was not found in Load Balancer %q (Resource Group: %q)", name, *loadBalancer.Name, resourceGroup) | ||
} | ||
|
||
return fmt.Errorf("Error retrieving Load Balancer %s: %s", name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can drop the extraneous "Error" prefix
return fmt.Errorf("Error retrieving Load Balancer %s: %s", name, err) | |
return fmt.Errorf("retrieving Load Balancer %s: %s", name, err) | |
|
||
if props.BackendAddressPool != nil { | ||
if err := d.Set("backend_address_pool_id", props.BackendAddressPool.ID); err != nil { | ||
return fmt.Errorf("Error setting `backend_address_pool_id`: %+v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
return fmt.Errorf("Error setting `backend_address_pool_id`: %+v", err) | |
return fmt.Errorf("setting `backend_address_pool_id`: %+v", err) |
|
||
if props.Probe != nil { | ||
if err := d.Set("probe_id", props.Probe.ID); err != nil { | ||
return fmt.Errorf("Error setting `probe_id`: %+v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
return fmt.Errorf("Error setting `probe_id`: %+v", err) | |
return fmt.Errorf("setting `probe_id`: %+v", err) |
resource_group_name = "${azurerm_resource_group.test.name}" | ||
loadbalancer_id = "${azurerm_lb.test.id}" | ||
} | ||
|
||
resource "azurerm_lb_probe" "test" { | ||
name = "%s" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
loadbalancer_id = "${azurerm_lb.test.id}" | ||
protocol = "Tcp" | ||
port = 443 | ||
} | ||
|
||
resource "azurerm_lb_rule" "test" { | ||
name = "%s" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
loadbalancer_id = "${azurerm_lb.test.id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use TF 0.12 syntax?
resource_group_name = "${azurerm_resource_group.test.name}" | |
loadbalancer_id = "${azurerm_lb.test.id}" | |
} | |
resource "azurerm_lb_probe" "test" { | |
name = "%s" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
loadbalancer_id = "${azurerm_lb.test.id}" | |
protocol = "Tcp" | |
port = 443 | |
} | |
resource "azurerm_lb_rule" "test" { | |
name = "%s" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
loadbalancer_id = "${azurerm_lb.test.id}" | |
resource_group_name = azurerm_resource_group.test.name | |
loadbalancer_id = azurerm_lb.test.id | |
} | |
resource "azurerm_lb_probe" "test" { | |
name = "%s" | |
resource_group_name = azurerm_resource_group.test.name | |
loadbalancer_id = azurerm_lb.test.id | |
protocol = "Tcp" | |
port = 443 | |
} | |
resource "azurerm_lb_rule" "test" { | |
name = "%s" | |
resource_group_name = azurerm_resource_group.test.name | |
loadbalancer_id = azurerm_lb.test.id |
website/docs/d/lb_rule.html.markdown
Outdated
--- | ||
subcategory: "Load Balancer" | ||
layout: "azurerm" | ||
page_title: "Azure Resource Manager: Data Source: azurerm_lb_rule" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to specify this is a data source in the title
page_title: "Azure Resource Manager: Data Source: azurerm_lb_rule" | |
page_title: "Azure Resource Manager: azurerm_lb_rule" |
website/docs/d/lb_rule.html.markdown
Outdated
|
||
* `name` - (Required) The name of this Load Balancer Rule. | ||
|
||
* `resource_group_name` - (Required) The name of the Resource Group where the Load Balancer Rule exists. Changing this forces a new Load Balancer Rule to be created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `resource_group_name` - (Required) The name of the Resource Group where the Load Balancer Rule exists. Changing this forces a new Load Balancer Rule to be created. | |
* `resource_group_name` - (Required) The name of the Resource Group where the Load Balancer Rule exists. |
website/docs/d/lb_rule.html.markdown
Outdated
|
||
* `load_distribution` - Specifies the load balancing distribution type used by the Load Balancer. | ||
|
||
* `disable_outbound_snat` - If snat is enabled for this Load Balancer Rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `disable_outbound_snat` - If snat is enabled for this Load Balancer Rule. | |
* `disable_outbound_snat` - If outbound SNAT is enabled for this Load Balancer Rule. |
website/docs/d/lb_rule.html.markdown
Outdated
|
||
* `backend_port` - The port used for internal connections on the endpoint. | ||
|
||
* `enable_floating_ip` - If Floating IPs are enabled for this Load Balncer Rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `enable_floating_ip` - If Floating IPs are enabled for this Load Balncer Rule | |
* `enable_floating_ip` - If Floating IPs are enabled for this Load Balancer Rule |
Thanks for the review @manicminer. Latest commit addresses the comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alvintang, LGTM 👍
This has been released in version 2.27.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.27.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Changes in this PR for #8271:
azurerm_lb_rule
azurerm_lb_rule
data sourceazurerm_lb_rule
Fixes #8271