-
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
New Resource/Data Source: azurerm_private_link_service
, Data Source: azurerm_private_link_service_endpoint_connections
and expose in azurerm_lb
and azurerm_subnet
#4426
Conversation
azurerm_private_link_service
and expose in azurerm_lb
and azurerm_subnet
azurerm_private_link_service
and expose in azurerm_lb
and azurerm_subnet
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 for the PR @WodansSon, i've left some comments inline that need to be addressed before merge.
ValidateFunc: validate.NoEmptyStrings, | ||
}, | ||
|
||
"location": azure.SchemaLocation(), |
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.
Should this be azure.SchemaLocationForDataSource
?
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.
Fixed.
|
||
"location": azure.SchemaLocation(), | ||
|
||
"resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), |
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.
Whats the reasoning behind suppressing case difference here?
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.
Defensive programming, Azure tends to not be very consistent with casing... I removed it and switched it to SchemaResourceGroupNameForDataSource
Computed: true, | ||
}, | ||
"location": azure.SchemaLocationForDataSource(), | ||
"tags": tagsForDataSourceSchema(), |
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 the new tags.SchemaForDataSource
function
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.
Fixed.
website/docs/r/subnet.html.markdown
Outdated
@@ -99,6 +101,7 @@ The following attributes are exported: | |||
* `resource_group_name` - The name of the resource group in which the subnet is created in. | |||
* `virtual_network_name` - The name of the virtual network in which the subnet is created in | |||
* `address_prefix` - The address prefix for the subnet | |||
* `private_link_service_network_policies` - Enable or Disable apply network policies on private link service in the subnet. |
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.
Do we need this as it is in the above docs?
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.
This setting is only for subnet resource.
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.
line 62 describes this?
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 question
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 don't know how to explain it other than what is said here, what exactly are you expecting here?
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 only added one property to the schema, yet there are two new properties in the docs? was one already existing?
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.
Yes that was the original attribute name, I missed that one.
website/docs/r/subnet.html.markdown
Outdated
@@ -59,6 +59,8 @@ The following arguments are supported: | |||
|
|||
* `address_prefix` - (Required) The address prefix to use for the subnet. | |||
|
|||
* `private_link_service_network_policies` - (Optional) Enable or Disable apply network policies on private link service in the subnet. |
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.
Could we word this to be more consistent with the rest of the docs:
* `private_link_service_network_policies` - (Optional) Enable or Disable apply network policies on private link service in the subnet. | |
* `private_link_service_network_policies` - (Optional) Are network policies enabled on private links in this subnet? |
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.
This is a string? What are the valid options? shouldn't this be a bool?
func testAccAzureRMPrivateLinkService_basic(rInt int, location string) string { | ||
standardResources := testAccAzureRMPrivateLinkServiceTemplate_standardResources(rInt, location) | ||
privateLink := testAccAzureRMPrivateLinkServiceTemplate_basic(rInt) | ||
|
||
return testAccAzureRMPrivateLinkServiceTemplate("", standardResources, privateLink) | ||
} | ||
|
||
func testAccAzureRMPrivateLinkService_update(rInt int, location string) string { | ||
standardResources := testAccAzureRMPrivateLinkServiceTemplate_standardResources(rInt, location) | ||
privateLink := testAccAzureRMPrivateLinkServiceTemplate_update(rInt) | ||
|
||
return testAccAzureRMPrivateLinkServiceTemplate("", standardResources, privateLink) | ||
} | ||
|
||
func testAccAzureRMPrivateLinkService_complete(rInt int, location string) string { | ||
subscriptionDataSource := testAccAzureRMPrivateLinkServiceTemplate_subscriptionDataSource() | ||
standardResources := testAccAzureRMPrivateLinkServiceTemplate_standardResources(rInt, location) | ||
privateLink := testAccAzureRMPrivateLinkServiceTemplate_complete(rInt) | ||
|
||
return testAccAzureRMPrivateLinkServiceTemplate(subscriptionDataSource, standardResources, privateLink) | ||
} |
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 don't see the value in this, we could just include subscriptionDataSource
bit in the standardResources
and call it a day
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.
fixed.
`, rInt, rInt) | ||
} | ||
|
||
func testAccAzureRMPrivateLinkServiceTemplate_complete(rInt int) 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.
could we just use this and add the standard resources in here?
func testAccAzureRMPrivateLinkServiceTemplate_complete(rInt int) string { | |
func testAccAzureRMPrivateLinkService_complete(rInt int) 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.
fixed.
`, rInt, rInt) | ||
} | ||
|
||
func testAccAzureRMPrivateLinkServiceTemplate_update(rInt int) 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.
Could we just use the standard resources template in here?
func testAccAzureRMPrivateLinkServiceTemplate_update(rInt int) string { | |
func testAccAzureRMPrivateLinkService_update(rInt int) 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.
fixed
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.
(duplicate)
return fmt.Errorf("Error checking for present of existing Private Link Service %q (Resource Group %q): %+v", name, resourceGroup, err) | ||
} | ||
} | ||
if !utils.ResponseWasNotFound(resp.Response) { |
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.
This should be
if !utils.ResponseWasNotFound(resp.Response) { | |
if if existing.ID != nil && *existing.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.
fixed
Co-Authored-By: kt <kt@katbyte.me>
…form-provider-azurerm into nr_private-link-service
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 for the revisions @WodansSon,
Just a couple comments left that should be addressed
"auto_approval_subscription_ids": { | ||
Type: schema.TypeSet, | ||
Optional: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, |
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.
Could we validate these are IDs?
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.
Fixed.
"visibility_subscription_ids": { | ||
Type: schema.TypeSet, | ||
Optional: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, |
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.
Could we validate these are IDs?
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.
Fixed.
"load_balancer_frontend_ip_configuration_ids": { | ||
Type: schema.TypeSet, | ||
Required: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, |
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.
Could we validate these are IDs?
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.
Fixed.
"network_interface_ids": { | ||
Type: schema.TypeSet, | ||
Computed: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, |
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.
Could we validate these are IDs?
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.
Fixed.
|
||
if props := resp.PrivateLinkServiceProperties; props != nil { | ||
d.Set("alias", props.Alias) | ||
if props.AutoApproval != nil { |
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 the glatten function will deal with nil
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.
Fixed.
return fmt.Errorf("Error setting `auto_approval_subscription_ids`: %+v", err) | ||
} | ||
} | ||
if props.Visibility != nil { |
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 the glatten function will deal with nil
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.
Fixed.
resource.TestCheckResourceAttr(resourceName, "load_balancer_frontend_ip_configuration_ids.#", "1"), | ||
resource.TestCheckResourceAttrSet(resourceName, "load_balancer_frontend_ip_configuration_ids.0"), | ||
), | ||
}, |
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 the import step is still missing?
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 @WodansSon, LGTM now! 🚀
This has been released in version 1.37.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 = "~> 1.37.0"
}
# ... other configuration ... |
Is there a plan to add properties.enableProxyProtocol feature to privatelink service.
but then terraform apply would reset enableProxyProtocol back to False again. |
|
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
(fixes #4701 )