-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/azurerm Fix multiple loadbalancer resource IDs #9401
Conversation
e686cb8
to
ab95a32
Compare
@@ -128,7 +128,18 @@ func resourceArmLoadBalancerProbeCreate(d *schema.ResourceData, meta interface{} | |||
return fmt.Errorf("Cannot read LoadBalancer %s (resource group %s) ID", loadBalancerName, resGroup) | |||
} | |||
|
|||
d.SetId(*read.ID) | |||
var createdProbe_id string |
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 could use retrieveLoadBalancerById() here again then findLoadBalancerProbeByName(), but it's another call to the API.
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.
I think it's fine to read the response here and avoid the additional round trip.
…b_nat_rule, azurerm_lb_nat_pool.
ec4af6f
to
7b133ad
Compare
The check for ARM_SUBSCRIPTION_ID breaks the PR testing. The PR testing isn't trying to check acceptance tests anyway. There will still be a correct failure for missing ARM_SUBSCRIPTION_ID when running the acceptance test due to the later testAccPreCheck().
This is ready for review. Passing tests listed below.
|
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.
Hi @carinadigital! Thanks for submitting this pull request. I'm going to merge it for the imminent version of Terraform after making a few local tweaks to the error messages.
if pool_id != "" { | ||
d.SetId(pool_id) | ||
} else { | ||
return fmt.Errorf("Error can not find created loadbalacner backend address pool id %s", pool_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.
loadbalacner
=> LoadBalancer
@@ -15,6 +16,11 @@ func TestAccAzureRMLoadBalancerBackEndAddressPool_basic(t *testing.T) { | |||
ri := acctest.RandInt() | |||
addressPoolName := fmt.Sprintf("%d-address-pool", ri) | |||
|
|||
subscriptionID := os.Getenv("ARM_SUBSCRIPTION_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.
I think we expose this via the provider?
@@ -128,7 +128,18 @@ func resourceArmLoadBalancerProbeCreate(d *schema.ResourceData, meta interface{} | |||
return fmt.Errorf("Cannot read LoadBalancer %s (resource group %s) ID", loadBalancerName, resGroup) | |||
} | |||
|
|||
d.SetId(*read.ID) | |||
var createdProbe_id string |
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.
I think it's fine to read the response here and avoid the additional round trip.
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes GH-9311 and usage of ID property for azurerm loadbalancers including:
azurerm_lb_probe
azurerm_lb_backend_address_pool
azurerm_lb_rule
azurerm_lb_nat_rule
azurerm_lb_nat_pool