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_dns_resolver_inbound_endpoint - mark private_ip_address as Optional #25035

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ func (r PrivateDNSResolverInboundEndpointResource) Arguments() map[string]*plugi
ValidateFunc: commonids.ValidateSubnetID,
},

// When `private_ip_allocation_method` is `Dynamic`, API would automatically set the value for `private_ip_address`
// When `private_ip_allocation_method` is `Static`, `private_ip_address` needs to be set by user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put this as validation in the create instead of documenting it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

image

"private_ip_address": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ func TestAccDNSResolverInboundEndpoint_update(t *testing.T) {
})
}

func TestAccDNSResolverInboundEndpoint_static(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_private_dns_resolver_inbound_endpoint", "test")
r := DNSResolverInboundEndpointResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.static(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func (r DNSResolverInboundEndpointResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := inboundendpoints.ParseInboundEndpointID(state.ID)
if err != nil {
Expand Down Expand Up @@ -112,7 +126,7 @@ resource "azurerm_resource_group" "test" {
}

resource "azurerm_virtual_network" "test" {
name = "acctest-rg-%[2]d"
name = "acctest-vnet-%[2]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
address_space = ["10.0.0.0/16"]
Expand Down Expand Up @@ -226,3 +240,22 @@ resource "azurerm_private_dns_resolver_inbound_endpoint" "test" {
}
`, template, data.RandomInteger)
}

func (r DNSResolverInboundEndpointResource) static(data acceptance.TestData) string {
template := r.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
private_ip_allocation_method = "Static"
private_ip_address = "10.0.0.4"
}
}
`, template, data.RandomInteger)
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,18 @@ The following arguments are supported:

An `ip_configurations` block supports the following:

* `private_ip_allocation_method` - (Optional) Private IP address allocation method. Allowed value is `Dynamic` and `Static`. Defaults to `Dynamic`.

* `subnet_id` - (Required) The subnet ID of the IP configuration.

* `private_ip_address` - (Optional) Private IP address of the IP configuration.

* `private_ip_allocation_method` - (Optional) Private IP address allocation method. Allowed value is `Dynamic` and `Static`. Defaults to `Dynamic`.

## Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

* `id` - The ID of the Private DNS Resolver Inbound Endpoint.

---

An `ip_configurations` block exports the following:

* `private_ip_address` - Private IP address of the IP configuration.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:
Expand Down
Loading