Skip to content

Add resource identity and list support to azurerm_public_ip#31762

Merged
mstroob merged 8 commits intomainfrom
mstroob/public-ip-list-and-identity
Feb 17, 2026
Merged

Add resource identity and list support to azurerm_public_ip#31762
mstroob merged 8 commits intomainfrom
mstroob/public-ip-list-and-identity

Conversation

@mstroob
Copy link
Contributor

@mstroob mstroob commented Feb 17, 2026

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

This PR adds support for the new Terraform 1.14+ list block functionality and resource identity feature to the azurerm_public_ip resource.

Changes include:

  1. Resource Identity Support: Adds identity schema to the azurerm_public_ip resource, allowing users to reference resources using structured identity fields (subscription_id, resource_group_name, name) instead of just the resource ID string
  2. List Functionality: Implements list support for querying Public IP resources at the subscription and resource group level using Terraform's new list block syntax
  3. Refactoring: Extracts the flatten logic into a separate resourcePublicIpFlatten function to enable code reuse between read and list operations
  4. Test Coverage: Adds comprehensive tests for both resource identity and list functionality

This enhancement improves the developer experience by:

  • Enabling more intuitive resource references using identity fields
  • Supporting bulk queries of Public IP resources for data analysis and automation scenarios
  • Aligning with Terraform 1.14+ best practices for resource management

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass.

Test Coverage:

  • Added TestAccPublicIp_resourceIdentity to verify identity field population and import functionality
  • Added TestAccPublicIp_listBySubscriptionAndRG to verify list functionality at both subscription and resource group scopes
  • All tests verify proper identity field matching and query result expectations
  • Tests require Terraform 1.14+ (enforced via tfversion.SkipBelow)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

* `azurerm_public_ip` - support for resource identity fields (`subscription_id`, `name`, `resource_group_name`) [GH-XXXXX]
* `azurerm_public_ip` - support for the `list` block to query Public IP resources by subscription or resource group [GH-XXXXX]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

N/A - This is an enhancement to support new Terraform 1.14+ functionality

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

No changes to security controls. This PR only adds new query capabilities and identity field support; it does not modify any security-related functionality such as access controls, encryption, or logging.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@mstroob mstroob changed the title Add resource identity and list support to azurerm_public_ip Add resource identity and list support to azurerm_public_ip Feb 17, 2026
@mstroob
Copy link
Contributor Author

mstroob commented Feb 17, 2026

Team City Test Results:

PR Number: 31762
.Build Number: 614604

All Tests
Status Test Name Duration
✅ PASS TestAccPublicIp_listBySubscriptionAndRG 117.67s
✅ PASS TestAccPublicIpPrefix_disappears 251.62s
✅ PASS TestAccPublicIpStatic_standard_withIPv6 270.45s
✅ PASS TestAccPublicIpPrefix_requiresImport 275.73s
✅ PASS TestAccPublicIpStatic_requiresImport 277.16s
✅ PASS TestAccPublicIpStatic_basic_withDNSLabel 298.60s
✅ PASS TestAccPublicIpPrefix_resourceIdentity 310.82s
✅ PASS TestAccPublicIpPrefix_regionalTier 322.17s
✅ PASS TestAccPublicIpPrefix_update 333.36s
✅ PASS TestAccPublicIp_resourceIdentity 333.94s
✅ PASS TestAccPublicIpPrefix_prefixLength31 340.26s
✅ PASS TestAccPublicIpPrefix_ipv6 340.76s
✅ PASS TestAccPublicIp_zonesSingle 342.45s
✅ PASS TestAccPublicIpPrefix_basic 342.43s
✅ PASS TestAccPublicIpPrefix_globalTier 343.76s
✅ PASS TestAccPublicIp_zonesMultiple 344.83s
✅ PASS TestAccPublicIpPrefix_zonesSingle 345.07s
✅ PASS TestAccPublicIpPrefix_zonesMultiple 345.33s
✅ PASS TestAccPublicIpStatic_basic 354.31s
✅ PASS TestAccPublicIpPrefix_prefixLength24 355.61s
✅ PASS TestAccPublicIpDynamic_basic_withIPv6 248.56s
✅ PASS TestAccPublicIpStatic_disappears 150.56s
✅ PASS TestAccPublicIpStatic_basic_defaultsToIPv4 244.89s
✅ PASS TestAccPublicIpStatic_basic_withIPv4 234.30s
✅ PASS TestAccPublicIpStatic_standard 235.05s
✅ PASS TestAccPublicIpStatic_standardPrefix 183.23s
✅ PASS TestAccPublicIpStatic_withTags 205.14s
✅ PASS TestAccPublicIpDynamic_basic 227.97s
✅ PASS TestAccPublicIpStatic_ipTags 230.22s
✅ PASS TestAccPublicIpStatic_globalTier 230.11s
✅ PASS TestAccPublicIpStatic_regionalTier 231.74s
✅ PASS TestAccPublicIpStatic_edgeZone 232.02s
✅ PASS TestAccPublicIpStatic_canLabelBe63 240.18s
✅ PASS TestAccPublicIpStatic_update 255.23s
✅ PASS TestAccPublicIpStatic_idleTimeout 284.83s
✅ PASS TestAccPublicIpStatic_standardPrefixWithTags 256.68s
✅ PASS TestAccPublicIpStatic_standard_withDDoS 332.30s

Total Passed: 37
Total Failed: 0
Total Tests: 37

Copy link
Collaborator

@sreallymatt sreallymatt left a comment

Choose a reason for hiding this comment

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

Thanks @mstroob - LGTM 🧇

@mstroob mstroob merged commit 92abf5d into main Feb 17, 2026
48 checks passed
@mstroob mstroob deleted the mstroob/public-ip-list-and-identity branch February 17, 2026 21:20
@github-actions github-actions bot added this to the v4.61.0 milestone Feb 17, 2026
anurag-hashicorp pushed a commit to anurag-hashicorp/terraform-provider-azurerm that referenced this pull request Feb 19, 2026
…orp#31762)

Add resource identity and list support to `azurerm_public_ip` (hashicorp#31762)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants