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

Add limited support for blueprint assignments #6930

Merged
merged 26 commits into from Jun 9, 2020
Merged

Conversation

jackofallops
Copy link
Member

Blocked on testing capability in CI Environment

WIP flagged until new CI environment ready.

Local tests Passing:

=== RUN   TestAccBlueprintAssignment_basic
--- PASS: TestAccBlueprintAssignment_basic (113.18s)
=== RUN   TestAccBlueprintAssignment_subscriptionComplete
--- PASS: TestAccBlueprintAssignment_subscriptionComplete (134.03s)
=== RUN   TestAccBlueprintAssignment_managementGroup
--- PASS: TestAccBlueprintAssignment_managementGroup (125.12s)
=== RUN   TestAccDataSourceBlueprintDefinition_basic
=== PAUSE TestAccDataSourceBlueprintDefinition_basic
=== RUN   TestAccDataSourceBlueprintDefinition_basicAtRootManagementGroup
=== PAUSE TestAccDataSourceBlueprintDefinition_basicAtRootManagementGroup
=== RUN   TestAccDataSourceBlueprintDefinition_basicAtChildManagementGroup
=== PAUSE TestAccDataSourceBlueprintDefinition_basicAtChildManagementGroup
=== RUN   TestAccDataSourceBlueprintPublishedVersion_atSubscription
=== PAUSE TestAccDataSourceBlueprintPublishedVersion_atSubscription
=== RUN   TestAccDataSourceBlueprintPublishedVersion_atRootManagementGroup
=== PAUSE TestAccDataSourceBlueprintPublishedVersion_atRootManagementGroup
=== RUN   TestAccDataSourceBlueprintPublishedVersion_atChildManagementGroup
=== PAUSE TestAccDataSourceBlueprintPublishedVersion_atChildManagementGroup
=== CONT  TestAccDataSourceBlueprintDefinition_basic
=== CONT  TestAccDataSourceBlueprintPublishedVersion_atRootManagementGroup
=== CONT  TestAccDataSourceBlueprintDefinition_basicAtChildManagementGroup
=== CONT  TestAccDataSourceBlueprintPublishedVersion_atChildManagementGroup
=== CONT  TestAccDataSourceBlueprintPublishedVersion_atSubscription
=== CONT  TestAccDataSourceBlueprintDefinition_basicAtRootManagementGroup
--- PASS: TestAccDataSourceBlueprintPublishedVersion_atChildManagementGroup (22.01s)
--- PASS: TestAccDataSourceBlueprintPublishedVersion_atRootManagementGroup (22.36s)
--- PASS: TestAccDataSourceBlueprintDefinition_basicAtChildManagementGroup (22.43s)
--- PASS: TestAccDataSourceBlueprintDefinition_basicAtRootManagementGroup (22.82s)
--- PASS: TestAccDataSourceBlueprintDefinition_basic (22.89s)
--- PASS: TestAccDataSourceBlueprintPublishedVersion_atSubscription (23.09s)
PASS

co-authored-by: @ArcturusZhang

Copy link
Contributor

@ArcturusZhang ArcturusZhang left a comment

Choose a reason for hiding this comment

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

@jackofallops thanks for this PR!
I have been asked for the blueprints quite a few times... Glad to see this resource back to track.
Despite this is still in draft, I have a little suggestion, please see the comment

azurerm/helpers/azure/identity.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ArcturusZhang ArcturusZhang left a comment

Choose a reason for hiding this comment

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

Hi @jackofallops Thanks for the great. I made some suggestion on the design of the scope part (and the related ID parsing functions). I assume it should be better to raise these when the PR is still in draft. I personally prefer to unify the scope by introducing one attribute called scope_id instead of when using different scopes, the user has to assign different attribute. What do you think?

}

switch idParts[0] {
case "providers":
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar concern with blueprint ID

}

switch idParts[0] {
case "providers":
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, we already have a parsing function of Management Group IDs in the managementgroup/parse directory, and also in the managementgroup directory, we have a little function used for parsing an ID of a subscription (like /subscriptions/00000000-0000-0000-0000-000000000000/)
Could we please reuse those logic here? I suppose the logic here to parse the ID is too complicated.
We could first split the ID by using this part /providers/Microsoft.Blueprint and then the first part should be the scope ID, and the last part should be all the information about its own.

azurerm/internal/services/blueprints/validate/identity.go Outdated Show resolved Hide resolved
@jackofallops jackofallops marked this pull request as ready for review June 4, 2020 08:20
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM with some minor extra checks and an ask for a test that updates the resource

@jackofallops jackofallops modified the milestones: Blocked, v2.14.0 Jun 9, 2020
@jackofallops
Copy link
Member Author

Tests pass:
image

@jackofallops jackofallops merged commit 832bf4b into master Jun 9, 2020
@jackofallops jackofallops deleted the f/bp-assignments branch June 9, 2020 09:20
jackofallops added a commit that referenced this pull request Jun 9, 2020
@ghost
Copy link

ghost commented Jun 11, 2020

This has been released in version 2.14.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.14.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jul 9, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jul 9, 2020
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.

None yet

4 participants