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

feat: Provider functions to build azure resource id #553

Merged
merged 20 commits into from
Aug 28, 2024

Conversation

hqhqhqhqhqhqhqhqhqhqhq
Copy link
Collaborator

As a part of https://github.com/Azure/terraform-provider-azapi/issues/533>

Several functions are provided to build resource id of different scope

  • if parentId is known -> build_resource_id with parent_id, type, name
  • if tenant scope -> build_tenant_scope_resource_id with type, name
  • if management group scope -> build_management_group_scope_resource_id with management_group_id, type, name
  • if subscription scope -> build_subscription_scope_resource_id with subscription_id, type, name
  • if resource group scope -> build_resource_group_scope_resource_id with subscription_id, resource_group_name, type, name

@hqhqhqhqhqhqhqhqhqhqhq hqhqhqhqhqhqhqhqhqhqhq force-pushed the feature-provider-function branch 3 times, most recently from 9894ebf to 002524d Compare July 20, 2024 07:43
Create main.yml

Update codeql.yaml

Update main.yml

Update main.yml

Update main.yml

Update main.yml

Update main.yml
This reverts commit e8701ff.
@ms-henglu ms-henglu marked this pull request as ready for review August 8, 2024 05:11
@ms-henglu ms-henglu changed the base branch from feature-provider-function to feature-two-point-oh August 8, 2024 05:11
Copy link
Member

@ms-henglu ms-henglu left a comment

Choose a reason for hiding this comment

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

Thank you so much for this PR! It mostly LGTM, just some minor suggestions, please check.

@ms-henglu ms-henglu changed the base branch from feature-two-point-oh to main August 16, 2024 08:53
Copy link
Member

@ms-henglu ms-henglu left a comment

Choose a reason for hiding this comment

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

Thanks @hqhqhqhqhqhqhqhqhqhqhq for the PR! It mostly LGTM, just some minor suggestions. Once they're addressed, I'll merge this PR.

```terraform
locals {
resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1"
extension_name = "Microsoft.Authorization/locks"
Copy link
Member

Choose a reason for hiding this comment

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

I guess it's a typo, it should be "resource_type"?

@@ -0,0 +1,216 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need this doc, because we have docs for each provider function.

}

output "resource_id" {
value = provider::azapi::build_resource_id(local.parent_id, local.resource_type, local.name)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment which shows the result of the provider function, it will help users understand how it works. And please also update other places.

@ms-henglu
Copy link
Member

And please also resolve the conflicts.

@hqhqhqhqhqhqhqhqhqhqhq
Copy link
Collaborator Author

And please also resolve the conflicts.

Required changes have been made, please review when available, thanks!

Copy link
Member

@ms-henglu ms-henglu left a comment

Choose a reason for hiding this comment

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

LGTM!

@ms-henglu ms-henglu merged commit 2cde423 into Azure:main Aug 28, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants