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

azurerm_private_link_service - add support for fqdns #17366

Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions internal/services/network/private_link_service_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ func resourcePrivateLinkService() *pluginsdk.Resource {
Set: pluginsdk.HashString,
},

"fqdns": {
Type: pluginsdk.TypeList,
Optional: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
},
},

// Required by the API you can't create the resource without at least
// one ip configuration once primary is set it is set forever unless
// you destroy the resource and recreate it.
Expand Down Expand Up @@ -190,6 +199,7 @@ func resourcePrivateLinkServiceCreateUpdate(d *pluginsdk.ResourceData, meta inte
},
IPConfigurations: expandPrivateLinkServiceIPConfiguration(primaryIpConfiguration),
LoadBalancerFrontendIPConfigurations: expandPrivateLinkServiceFrontendIPConfiguration(loadBalancerFrontendIpConfigurations),
Fqdns: utils.ExpandStringSlice(d.Get("fqdns").([]interface{})),
},
Tags: tags.Expand(t),
}
Expand Down Expand Up @@ -271,6 +281,10 @@ func resourcePrivateLinkServiceRead(d *pluginsdk.ResourceData, meta interface{})
return fmt.Errorf("setting `visibility_subscription_ids`: %+v", err)
}

if err := d.Set("fqdns", utils.FlattenStringSlice(props.Fqdns)); err != nil {
return fmt.Errorf("setting `fqdns`: %+v", err)
}

if err := d.Set("nat_ip_configuration", flattenPrivateLinkServiceIPConfiguration(props.IPConfigurations)); err != nil {
return fmt.Errorf("setting `nat_ip_configuration`: %+v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ resource "azurerm_private_link_service" "test" {
resource_group_name = azurerm_resource_group.test.name
auto_approval_subscription_ids = [data.azurerm_subscription.current.subscription_id]
visibility_subscription_ids = [data.azurerm_subscription.current.subscription_id]
fqdns = ["foo.com", "bar.com"]

nat_ip_configuration {
name = "primaryIpConfiguration-%d"
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/private_link_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ The following arguments are supported:

* `enable_proxy_protocol` - (Optional) Should the Private Link Service support the Proxy Protocol? Defaults to `false`.

* `fqdns` - (Optional) List of FQDNs allowed for the Private Link Service.

* `tags` - (Optional) A mapping of tags to assign to the resource. Changing this forces a new resource to be created.

* `visibility_subscription_ids` - (Optional) A list of Subscription UUID/GUID's that will be able to see this Private Link Service.
Expand Down