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

r\purview_account: Add support for managed_resource_group_name #14217

Merged
merged 2 commits into from
Nov 18, 2021

Conversation

myc2h6o
Copy link
Contributor

@myc2h6o myc2h6o commented Nov 17, 2021

  • When creating a Purview Account, a new resource group will be created automatically together with it. The name of this resource group is decided by server by default, and user can override it. This change adds support for the override capability.
  • The update API accepts the managedResourceGroupName, but it doesn't change the actual value, so the property is set to ForceNew
  • Validation is azure.ValidateResourceGroupName since it needs to be a valid resource group name
  • Test result:
    $ TF_ACC=1 go test -v ./internal/services/purview -run=TestAccPurviewAccount_ -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
    === RUN TestAccPurviewAccount_basic
    === PAUSE TestAccPurviewAccount_basic
    === RUN TestAccPurviewAccount_requiresImport
    === PAUSE TestAccPurviewAccount_requiresImport
    === RUN TestAccPurviewAccount_withManagedResourceGroupName
    === PAUSE TestAccPurviewAccount_withManagedResourceGroupName
    === CONT TestAccPurviewAccount_basic
    === CONT TestAccPurviewAccount_withManagedResourceGroupName
    === CONT TestAccPurviewAccount_requiresImport
    --- PASS: TestAccPurviewAccount_withManagedResourceGroupName (642.22s)
    --- PASS: TestAccPurviewAccount_requiresImport (663.07s)
    --- PASS: TestAccPurviewAccount_basic (735.61s)
    PASS
    ok github.com/hashicorp/terraform-provider-azurerm/internal/services/purview 736.292s

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks @myc2h6o! Looks good so far, just left a couple of minor comments inline.

@@ -39,6 +39,10 @@ The following arguments are supported:

* `public_network_enabled` - (Optional) Should the Purview Account be visible to the public network? Defaults to `true`.

* `managed_resource_group_name` - (Optional) The name of the Resource Group where Purview Account creates the managed resources.
Copy link
Member

Choose a reason for hiding this comment

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

We could remove the note and change the description:

Suggested change
* `managed_resource_group_name` - (Optional) The name of the Resource Group where Purview Account creates the managed resources.
* `managed_resource_group_name` - (Optional) The name which should be used for the new Resource Group where Purview Account creates the managed resources. Changing this forces a new Purview Account to be created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Description updated

Config: r.withManagedResourceGroupName(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Copy link
Member

Choose a reason for hiding this comment

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

could this include a check to see if the managed_resource_group_name itself has been set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved managed_resource_group_name to parameter and added the check for it.
I removed the update part as well since this is a ForceNew property

@myc2h6o
Copy link
Contributor Author

myc2h6o commented Nov 18, 2021

@catriona-m thanks for reviewing the change. I've resolved your comments, please take another look.

@myc2h6o myc2h6o force-pushed the purview_managed_rg branch 2 times, most recently from c7b9d5c to d2e11df Compare November 18, 2021 04:56
@katbyte katbyte added this to the v2.86.0 milestone Nov 18, 2021
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @myc2h6o - LGTM 👾

@katbyte katbyte merged commit 724b7b2 into hashicorp:main Nov 18, 2021
katbyte added a commit that referenced this pull request Nov 18, 2021
@myc2h6o myc2h6o deleted the purview_managed_rg branch November 18, 2021 08:07
@github-actions
Copy link

This functionality has been released in v2.86.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
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 21, 2021
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.

3 participants