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_public_ip_prefix: adding sku_tier property #27882

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

CorrenSoft
Copy link
Contributor

@CorrenSoft CorrenSoft commented Nov 4, 2024

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

  • Added sku_tier to the resource and the data source.
  • Updated TestAccDataSourcePublicIPPrefix_basic to validate the output value.
  • Added TestAccPublicIpPrefix_globalTier and TestAccPublicIpPrefix_regionalTier to test both possible values.
  • Updated docs.

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 relevent documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass.
make acctests SERVICE='network' TESTARGS='-run=TestAccDataSourcePublicIPPrefix_'

=== RUN   TestAccDataSourcePublicIPPrefix_basic
=== PAUSE TestAccDataSourcePublicIPPrefix_basic
=== CONT  TestAccDataSourcePublicIPPrefix_basic
--- PASS: TestAccDataSourcePublicIPPrefix_basic (167.14s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/network       167.429s
make acctests SERVICE='network' TESTARGS='-run=TestAccPublicIpPrefix_'

=== RUN   TestAccPublicIpPrefix_basic
=== PAUSE TestAccPublicIpPrefix_basic
=== RUN   TestAccPublicIpPrefix_globalTier
=== PAUSE TestAccPublicIpPrefix_globalTier
=== RUN   TestAccPublicIpPrefix_regionalTier
=== PAUSE TestAccPublicIpPrefix_regionalTier
=== RUN   TestAccPublicIpPrefix_ipv6
=== PAUSE TestAccPublicIpPrefix_ipv6
=== RUN   TestAccPublicIpPrefix_requiresImport
=== PAUSE TestAccPublicIpPrefix_requiresImport
=== RUN   TestAccPublicIpPrefix_prefixLength31
=== PAUSE TestAccPublicIpPrefix_prefixLength31
=== RUN   TestAccPublicIpPrefix_prefixLength24
=== PAUSE TestAccPublicIpPrefix_prefixLength24
=== RUN   TestAccPublicIpPrefix_update
=== PAUSE TestAccPublicIpPrefix_update
=== RUN   TestAccPublicIpPrefix_disappears
=== PAUSE TestAccPublicIpPrefix_disappears
=== RUN   TestAccPublicIpPrefix_zonesSingle
=== PAUSE TestAccPublicIpPrefix_zonesSingle
=== RUN   TestAccPublicIpPrefix_zonesMultiple
=== PAUSE TestAccPublicIpPrefix_zonesMultiple
=== CONT  TestAccPublicIpPrefix_basic
=== CONT  TestAccPublicIpPrefix_zonesSingle
=== CONT  TestAccPublicIpPrefix_prefixLength24
=== CONT  TestAccPublicIpPrefix_disappears
=== CONT  TestAccPublicIpPrefix_zonesMultiple
=== CONT  TestAccPublicIpPrefix_ipv6
=== CONT  TestAccPublicIpPrefix_prefixLength31
=== CONT  TestAccPublicIpPrefix_requiresImport
=== CONT  TestAccPublicIpPrefix_regionalTier
--- PASS: TestAccPublicIpPrefix_disappears (475.63s)
=== CONT  TestAccPublicIpPrefix_globalTier
--- PASS: TestAccPublicIpPrefix_requiresImport (484.94s)
=== CONT  TestAccPublicIpPrefix_update
--- PASS: TestAccPublicIpPrefix_zonesSingle (489.34s)
--- PASS: TestAccPublicIpPrefix_ipv6 (497.96s)
--- PASS: TestAccPublicIpPrefix_zonesMultiple (517.30s)
--- PASS: TestAccPublicIpPrefix_prefixLength31 (519.51s)
--- PASS: TestAccPublicIpPrefix_basic (589.28s)
--- PASS: TestAccPublicIpPrefix_regionalTier (293.36s)
--- PASS: TestAccPublicIpPrefix_update (193.22s)
--- PASS: TestAccPublicIpPrefix_globalTier (236.70s)

Note: Missing TestAccPublicIpPrefix_prefixLength24 because is not accepted in my working subscription.

Change Log

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

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)

Fixes #27877

Note

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

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks for this @CorrenSoft! This looks good, I just have one question and a suggestion. Once those are resolved this should be good to merge.

Comment on lines 71 to 74
ValidateFunc: validation.StringInSlice([]string{
string(publicipprefixes.PublicIPPrefixSkuTierGlobal),
string(publicipprefixes.PublicIPPrefixSkuTierRegional),
}, false),
Copy link
Member

Choose a reason for hiding this comment

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

This can be replaced with

Suggested change
ValidateFunc: validation.StringInSlice([]string{
string(publicipprefixes.PublicIPPrefixSkuTierGlobal),
string(publicipprefixes.PublicIPPrefixSkuTierRegional),
}, false),
ValidateFunc: validation.StringInSlice(PossibleValuesForPublicIPPrefixSkuTier(), false),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lovely, thank you.

"sku_tier": {
Type: pluginsdk.TypeString,
Optional: true,
Default: string(publicipprefixes.PublicIPPrefixSkuTierRegional),
Copy link
Member

Choose a reason for hiding this comment

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

Just confirming here, but Is this the default that existing resources created by Terraform would have?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, any resource created has that value.

"sku": {
    "name": "Standard",
    "tier": "Regional"
}

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Good stuff, thanks @CorrenSoft LGTM 🧊

@stephybun stephybun merged commit 2fc04ee into hashicorp:main Nov 5, 2024
35 checks passed
@github-actions github-actions bot added this to the v4.9.0 milestone Nov 5, 2024
stephybun added a commit that referenced this pull request Nov 5, 2024
@CorrenSoft CorrenSoft deleted the feature/27877 branch November 5, 2024 12:55
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.

Support for configuring SKU tier when creating a Public IP Prefix
3 participants