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_subscription - Fix error for subscription update #21255

Merged
merged 3 commits into from
Apr 13, 2023

Conversation

ms-zhenhua
Copy link
Contributor

fix #21241
Related PR: #18813

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hi @ms-zhenhua

Thanks for this PR.

As mentioned previously, we intentionally avoid hard-coding the Resource IDs in this fashion, we have the New{Type}ID methods which will return a ResourceID type, which has the .ID() method on it returning the expected string for this Resource ID.

As such can we update this to match the other resources in the Provider (and use the NewSubscriptionID method rather than hard-coding this)?

Thanks!

@ms-zhenhua
Copy link
Contributor Author

Hi @tombuildsstuff, thank you for reviewing. I have updated the code. Kindly take another review.

@jackofallops jackofallops self-assigned this Apr 12, 2023
@jackofallops jackofallops added this to the v3.53.0 milestone Apr 12, 2023
@jackofallops
Copy link
Member

Manual Testing results:

Create

azurerm_subscription.test: Still creating... [1m50s elapsed]
azurerm_subscription.test: Still creating... [2m0s elapsed]
azurerm_subscription.test: Creation complete after 2m10s [id=/providers/Microsoft.Subscription/aliases/testAcc-SteDev20230413-1]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Update

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azurerm_subscription.test will be updated in-place
  ~ resource "azurerm_subscription" "test" {
        id                = "/providers/Microsoft.Subscription/aliases/testAcc-SteDev20230413-1"
      ~ tags              = {
          + "updated" = "true"
        }
        # (5 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
azurerm_subscription.test: Modifying... [id=/providers/Microsoft.Subscription/aliases/testAcc-SteDev20230413-1]
azurerm_subscription.test: Modifications complete after 3s [id=/providers/Microsoft.Subscription/aliases/testAcc-SteDev20230413-1]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

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

Thanks @ms-zhenhua - Tested successfully and LGTM 👍

@jackofallops jackofallops modified the milestones: v3.53.0, v3.52.0 Apr 13, 2023
@jackofallops jackofallops merged commit fb8e284 into hashicorp:main Apr 13, 2023
jackofallops added a commit that referenced this pull request Apr 13, 2023
@github-actions
Copy link

This functionality has been released in v3.52.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_subscription expects two resource ID segments for subscription ID
4 participants