From decc3eab47d91a7aec8327ee12a6e47f4faee2b0 Mon Sep 17 00:00:00 2001 From: pchanvallon Date: Tue, 10 Jan 2023 17:15:14 +0100 Subject: [PATCH 1/3] feat(private-resolver): new datasource azurerm_private_dns_resolver_inbound_endpoint --- ...s_resolver_inbound_endpoint_data_source.go | 135 +++++++++++++++++ ...olver_inbound_endpoint_data_source_test.go | 139 ++++++++++++++++++ .../privatednsresolver/registration.go | 1 + ...ns_resolver_inbound_endpoint.html.markdown | 56 +++++++ 4 files changed, 331 insertions(+) create mode 100644 internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go create mode 100644 internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go create mode 100644 website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go new file mode 100644 index 000000000000..ae4fb231de61 --- /dev/null +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go @@ -0,0 +1,135 @@ +package privatednsresolver + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/dnsresolvers" + "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/inboundendpoints" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type PrivateDNSResolverInboundEndpointDataSourceModel struct { + Name string `tfschema:"name"` + PrivateDNSResolverId string `tfschema:"private_dns_resolver_id"` + IPConfigurations []IPConfigurationModel `tfschema:"ip_configurations"` + Location string `tfschema:"location"` + Tags map[string]string `tfschema:"tags"` +} + +type PrivateDNSResolverInboundEndpointDataSource struct{} + +var _ sdk.DataSource = PrivateDNSResolverInboundEndpointDataSource{} + +func (r PrivateDNSResolverInboundEndpointDataSource) ResourceType() string { + return "azurerm_private_dns_resolver_inbound_endpoint" +} + +func (r PrivateDNSResolverInboundEndpointDataSource) ModelObject() interface{} { + return &PrivateDNSResolverInboundEndpointDataSourceModel{} +} + +func (r PrivateDNSResolverInboundEndpointDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return inboundendpoints.ValidateInboundEndpointID +} + +func (r PrivateDNSResolverInboundEndpointDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "private_dns_resolver_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: dnsresolvers.ValidateDnsResolverID, + }, + } +} + +func (r PrivateDNSResolverInboundEndpointDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "ip_configurations": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "private_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "private_ip_allocation_method": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "location": commonschema.LocationComputed(), + + "tags": tags.SchemaDataSource(), + } +} + +func (r PrivateDNSResolverInboundEndpointDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.PrivateDnsResolver.InboundEndpointsClient + + var state PrivateDNSResolverInboundEndpointDataSourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + dnsForwardingRulesetId, err := inboundendpoints.ParseDnsResolverID(state.PrivateDNSResolverId) + if err != nil { + return err + } + + var top int64 = 1 + resp, err := client.ListCompleteMatchingPredicate(ctx, *dnsForwardingRulesetId, + inboundendpoints.ListOperationOptions{Top: &top}, + inboundendpoints.InboundEndpointOperationPredicate{Name: &state.Name}) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", state.Name, err) + } + if len(resp.Items) != int(top) { + return fmt.Errorf("retrieving %s: resource not found", state.Name) + } + + model := resp.Items[0] + id, err := inboundendpoints.ParseInboundEndpointID(*model.Id) + if err != nil { + return err + } + + state.Location = location.Normalize(model.Location) + state.PrivateDNSResolverId = dnsresolvers.NewDnsResolverID(id.SubscriptionId, id.ResourceGroupName, id.DnsResolverName).ID() + + state.IPConfigurations = flattenIPConfigurationModel(&model.Properties.IPConfigurations) + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go new file mode 100644 index 000000000000..28173119f08f --- /dev/null +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go @@ -0,0 +1,139 @@ +package privatednsresolver_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type DNSResolverInboundEndpointDataSource struct{} + +func TestAccDNSResolverInboundEndpointDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_private_dns_resolver_inbound_endpoint", "test") + d := DNSResolverInboundEndpointDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("private_dns_resolver_id").Exists(), + check.That(data.ResourceName).Key("location").HasValue(location.Normalize(data.Locations.Primary)), + check.That(data.ResourceName).Key("ip_configurations.0.subnet_id").Exists(), + check.That(data.ResourceName).Key("ip_configurations.0.private_ip_address").Exists(), + ), + }, + }) +} + +func TestAccDNSResolverInboundEndpointDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_private_dns_resolver_inbound_endpoint", "test") + d := DNSResolverInboundEndpointDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("private_dns_resolver_id").Exists(), + check.That(data.ResourceName).Key("location").HasValue(location.Normalize(data.Locations.Primary)), + check.That(data.ResourceName).Key("ip_configurations.0.private_ip_allocation_method").HasValue("Dynamic"), + check.That(data.ResourceName).Key("ip_configurations.0.subnet_id").Exists(), + check.That(data.ResourceName).Key("ip_configurations.0.private_ip_address").Exists(), + check.That(data.ResourceName).Key("tags.key").HasValue("value"), + ), + }, + }) +} + +func (d DNSResolverInboundEndpointDataSource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%[2]d" + location = "%[1]s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-rg-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + address_space = ["10.0.0.0/16"] +} + +resource "azurerm_subnet" "test" { + name = "inbounddns" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.0.0/28"] + + delegation { + name = "Microsoft.Network.dnsResolvers" + service_delegation { + actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"] + name = "Microsoft.Network/dnsResolvers" + } + } +} + +resource "azurerm_private_dns_resolver" "test" { + name = "acctest-dr-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + virtual_network_id = azurerm_virtual_network.test.id +} +`, data.Locations.Primary, data.RandomInteger) +} + +func (d DNSResolverInboundEndpointDataSource) basic(data acceptance.TestData) string { + template := d.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_private_dns_resolver_inbound_endpoint" "test" { + name = "acctest-drie-%d" + private_dns_resolver_id = azurerm_private_dns_resolver.test.id + location = azurerm_private_dns_resolver.test.location + ip_configurations { + subnet_id = azurerm_subnet.test.id + } +} + +data "azurerm_private_dns_resolver_inbound_endpoint" "test" { + name = azurerm_private_dns_resolver_inbound_endpoint.test.name + private_dns_resolver_id = azurerm_private_dns_resolver.test.id +} +`, template, data.RandomInteger) +} + +func (d DNSResolverInboundEndpointDataSource) complete(data acceptance.TestData) string { + template := d.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_private_dns_resolver_inbound_endpoint" "test" { + name = "acctest-drie-%d" + private_dns_resolver_id = azurerm_private_dns_resolver.test.id + location = azurerm_private_dns_resolver.test.location + ip_configurations { + private_ip_allocation_method = "Dynamic" + subnet_id = azurerm_subnet.test.id + } + tags = { + key = "value" + } +} + +data "azurerm_private_dns_resolver_inbound_endpoint" "test" { + name = azurerm_private_dns_resolver_inbound_endpoint.test.name + private_dns_resolver_id = azurerm_private_dns_resolver.test.id +} +`, template, data.RandomInteger) +} diff --git a/internal/services/privatednsresolver/registration.go b/internal/services/privatednsresolver/registration.go index 48787d55802a..c51a2a21600e 100644 --- a/internal/services/privatednsresolver/registration.go +++ b/internal/services/privatednsresolver/registration.go @@ -42,6 +42,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { func (r Registration) DataSources() []sdk.DataSource { return []sdk.DataSource{ PrivateDNSResolverDnsResolverDataSource{}, + PrivateDNSResolverInboundEndpointDataSource{}, } } diff --git a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown new file mode 100644 index 000000000000..04355643d3fd --- /dev/null +++ b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown @@ -0,0 +1,56 @@ +--- +subcategory: "Private DNS Resolver" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_private_dns_resolver_inbound_endpoint" +description: |- + Gets information about an existing Private DNS Resolver Inbound Endpoint. +--- + +# Data Source: azurerm_private_dns_resolver_inbound_endpoint + +Gets information about an existing Private DNS Resolver Inbound Endpoint. + +## Example Usage + +```hcl +resource "azurerm_private_dns_resolver_inbound_endpoint" "example" { + name = "example-drie" + private_dns_resolver_id = "example-private-dns-resolver-id" +} +``` + +## Arguments Reference + +The following arguments are required: + +* `name` - Name of the Private DNS Resolver Inbound Endpoint. + +* `private_dns_resolver_id` - ID of the Private DNS Resolver Inbound Endpoint. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Private DNS Resolver Inbound Endpoint. + +* `ip_configurations` - IP configurations. Each `ip_configurations` block as defined below. + +* `location` - Azure Region where the Private DNS Resolver Inbound Endpoint exists. + +* `tags` - Mapping of tags which should be assigned to the Private DNS Resolver Inbound Endpoint. + +--- + +An `ip_configurations` block exports the following: + +* `private_ip_allocation_method` - Private IP address allocation method. + +* `subnet_id` - Subnet ID of the IP configuration. + +* `private_ip_address` - Private IP address of the IP configuration. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Private DNS SRV Record. From 0158fdc36c244f173faf50cd74f947d83d46b450 Mon Sep 17 00:00:00 2001 From: pchanvallon Date: Wed, 11 Jan 2023 22:07:09 +0100 Subject: [PATCH 2/3] applying review suggestions --- ...s_resolver_inbound_endpoint_data_source.go | 22 +++--- ...olver_inbound_endpoint_data_source_test.go | 75 +++---------------- ...ns_resolver_inbound_endpoint.html.markdown | 18 ++--- 3 files changed, 30 insertions(+), 85 deletions(-) diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go index ae4fb231de61..4b46e5203f4e 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source.go @@ -102,21 +102,19 @@ func (r PrivateDNSResolverInboundEndpointDataSource) Read() sdk.ResourceFunc { return err } - var top int64 = 1 - resp, err := client.ListCompleteMatchingPredicate(ctx, *dnsForwardingRulesetId, - inboundendpoints.ListOperationOptions{Top: &top}, - inboundendpoints.InboundEndpointOperationPredicate{Name: &state.Name}) + id := inboundendpoints.NewInboundEndpointID( + dnsForwardingRulesetId.SubscriptionId, + dnsForwardingRulesetId.ResourceGroupName, + dnsForwardingRulesetId.DnsResolverName, + state.Name) + resp, err := client.Get(ctx, id) if err != nil { - return fmt.Errorf("retrieving %s: %+v", state.Name, err) - } - if len(resp.Items) != int(top) { - return fmt.Errorf("retrieving %s: resource not found", state.Name) + return fmt.Errorf("retrieving %s: %+v", id, err) } - model := resp.Items[0] - id, err := inboundendpoints.ParseInboundEndpointID(*model.Id) - if err != nil { - return err + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) } state.Location = location.Normalize(model.Location) diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go index 28173119f08f..efb3728ac614 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go @@ -29,33 +29,12 @@ func TestAccDNSResolverInboundEndpointDataSource_basic(t *testing.T) { }) } -func TestAccDNSResolverInboundEndpointDataSource_complete(t *testing.T) { - data := acceptance.BuildTestData(t, "data.azurerm_private_dns_resolver_inbound_endpoint", "test") - d := DNSResolverInboundEndpointDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: d.complete(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("name").Exists(), - check.That(data.ResourceName).Key("private_dns_resolver_id").Exists(), - check.That(data.ResourceName).Key("location").HasValue(location.Normalize(data.Locations.Primary)), - check.That(data.ResourceName).Key("ip_configurations.0.private_ip_allocation_method").HasValue("Dynamic"), - check.That(data.ResourceName).Key("ip_configurations.0.subnet_id").Exists(), - check.That(data.ResourceName).Key("ip_configurations.0.private_ip_address").Exists(), - check.That(data.ResourceName).Key("tags.key").HasValue("value"), - ), - }, - }) -} - -func (d DNSResolverInboundEndpointDataSource) template(data acceptance.TestData) string { +func (d DNSResolverInboundEndpointDataSource) basic(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { features {} } - resource "azurerm_resource_group" "test" { name = "acctest-rg-%[2]d" location = "%[1]s" @@ -89,51 +68,19 @@ resource "azurerm_private_dns_resolver" "test" { location = azurerm_resource_group.test.location virtual_network_id = azurerm_virtual_network.test.id } -`, data.Locations.Primary, data.RandomInteger) -} - -func (d DNSResolverInboundEndpointDataSource) basic(data acceptance.TestData) string { - template := d.template(data) - return fmt.Sprintf(` - %s resource "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = "acctest-drie-%d" - private_dns_resolver_id = azurerm_private_dns_resolver.test.id - location = azurerm_private_dns_resolver.test.location - ip_configurations { - subnet_id = azurerm_subnet.test.id - } -} - -data "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = azurerm_private_dns_resolver_inbound_endpoint.test.name + name = "acctest-drie-%[2]d" private_dns_resolver_id = azurerm_private_dns_resolver.test.id -} -`, template, data.RandomInteger) -} - -func (d DNSResolverInboundEndpointDataSource) complete(data acceptance.TestData) string { - template := d.template(data) - return fmt.Sprintf(` - %s - -resource "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = "acctest-drie-%d" - private_dns_resolver_id = azurerm_private_dns_resolver.test.id - location = azurerm_private_dns_resolver.test.location - ip_configurations { - private_ip_allocation_method = "Dynamic" - subnet_id = azurerm_subnet.test.id + location = azurerm_private_dns_resolver.test.location + ip_configurations { + subnet_id = azurerm_subnet.test.id + } } - tags = { - key = "value" - } -} -data "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = azurerm_private_dns_resolver_inbound_endpoint.test.name - private_dns_resolver_id = azurerm_private_dns_resolver.test.id -} -`, template, data.RandomInteger) + data "azurerm_private_dns_resolver_inbound_endpoint" "test" { + name = azurerm_private_dns_resolver_inbound_endpoint.test.name + private_dns_resolver_id = azurerm_private_dns_resolver.test.id + } +`, data.Locations.Primary, data.RandomInteger) } diff --git a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown index 04355643d3fd..e6954a573513 100644 --- a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown +++ b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown @@ -21,11 +21,11 @@ resource "azurerm_private_dns_resolver_inbound_endpoint" "example" { ## Arguments Reference -The following arguments are required: +The following arguments are supported: -* `name` - Name of the Private DNS Resolver Inbound Endpoint. +* `name` - (Required) Name of the Private DNS Resolver Inbound Endpoint. -* `private_dns_resolver_id` - ID of the Private DNS Resolver Inbound Endpoint. +* `private_dns_resolver_id` - (Required) ID of the Private DNS Resolver Inbound Endpoint. ## Attributes Reference @@ -33,21 +33,21 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the Private DNS Resolver Inbound Endpoint. -* `ip_configurations` - IP configurations. Each `ip_configurations` block as defined below. +* `ip_configurations` - A list of `ip_configurations` block as defined below. -* `location` - Azure Region where the Private DNS Resolver Inbound Endpoint exists. +* `location` - The Azure Region where the Private DNS Resolver Inbound Endpoint exists. -* `tags` - Mapping of tags which should be assigned to the Private DNS Resolver Inbound Endpoint. +* `tags` - Mapping of tags assigned to the Private DNS Resolver Inbound Endpoint. --- An `ip_configurations` block exports the following: -* `private_ip_allocation_method` - Private IP address allocation method. +* `private_ip_allocation_method` - The private IP address allocation method. -* `subnet_id` - Subnet ID of the IP configuration. +* `subnet_id` - The subnet ID of the IP configuration. -* `private_ip_address` - Private IP address of the IP configuration. +* `private_ip_address` - The private IP address of the IP configuration. ## Timeouts From 546aa17b8e7db3b1ec7e7c41a638b886b3680191 Mon Sep 17 00:00:00 2001 From: pchanvallon Date: Thu, 12 Jan 2023 09:13:57 +0100 Subject: [PATCH 3/3] updating documentation and tests following last comments --- ...olver_inbound_endpoint_data_source_test.go | 55 ++----------------- ...ns_resolver_inbound_endpoint.html.markdown | 4 +- 2 files changed, 7 insertions(+), 52 deletions(-) diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go index efb3728ac614..1a500ec5ce7f 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go @@ -31,56 +31,11 @@ func TestAccDNSResolverInboundEndpointDataSource_basic(t *testing.T) { func (d DNSResolverInboundEndpointDataSource) basic(data acceptance.TestData) string { return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -resource "azurerm_resource_group" "test" { - name = "acctest-rg-%[2]d" - location = "%[1]s" -} - -resource "azurerm_virtual_network" "test" { - name = "acctest-rg-%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - address_space = ["10.0.0.0/16"] -} - -resource "azurerm_subnet" "test" { - name = "inbounddns" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.0.0/28"] +%s - delegation { - name = "Microsoft.Network.dnsResolvers" - service_delegation { - actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"] - name = "Microsoft.Network/dnsResolvers" - } - } -} - -resource "azurerm_private_dns_resolver" "test" { - name = "acctest-dr-%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - virtual_network_id = azurerm_virtual_network.test.id -} - -resource "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = "acctest-drie-%[2]d" +data "azurerm_private_dns_resolver_inbound_endpoint" "test" { + name = azurerm_private_dns_resolver_inbound_endpoint.test.name private_dns_resolver_id = azurerm_private_dns_resolver.test.id - location = azurerm_private_dns_resolver.test.location - ip_configurations { - subnet_id = azurerm_subnet.test.id - } - } - - data "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = azurerm_private_dns_resolver_inbound_endpoint.test.name - private_dns_resolver_id = azurerm_private_dns_resolver.test.id - } -`, data.Locations.Primary, data.RandomInteger) +} +`, DNSResolverInboundEndpointResource{}.basic(data)) } diff --git a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown index e6954a573513..d940c2f401f4 100644 --- a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown +++ b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown @@ -37,7 +37,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `location` - The Azure Region where the Private DNS Resolver Inbound Endpoint exists. -* `tags` - Mapping of tags assigned to the Private DNS Resolver Inbound Endpoint. +* `tags` - The tags assigned to the Private DNS Resolver Inbound Endpoint. --- @@ -53,4 +53,4 @@ An `ip_configurations` block exports the following: The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `read` - (Defaults to 5 minutes) Used when retrieving the Private DNS SRV Record. +* `read` - (Defaults to 5 minutes) Used when retrieving the Private DNS Resolver Inbound Endpoint.