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

**New Resource:** azurerm_subscription #10718

Merged
merged 16 commits into from
Mar 4, 2021
Merged

Conversation

jackofallops
Copy link
Member

@jackofallops jackofallops commented Feb 24, 2021

This PR introduces a new resource to manage Subscriptions using the new SubscriptionAlias API.

Note: Creating Subscriptions requires a high level of access to the Azure Billing account in which the Subscription is being created/managed. The level of access is dependent on the account type with Azure (e.g. Enterprise Account, MCA, or Partner Account).

Note: Using this resource will create a Subscription Alias meta resource. Azure allows multiple Aliases per subscription, however, for Terraform to correctly manage this the Provider limits this to a 1:1 relationship. The Alias Meta resource has been introduced to give a common interface for creating Subscriptions across the various account types.

Warning: Destroying an azurerm_subscription resource will deactivate/cancel your subscription, including all resources contained within, through this resource. See here for what happens when this occurs.

Subscriptions containing resources not managed by Terraform will prevent that Subscription from being deleted/destroyed and return an error.
Error: autorest/azure: Service returned an error. Status=400 Code="ResourcesExistingOnSubscription" Message="There are existing resources associated with subscription. Delete them before cancelling the subscription"

closes #1216

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 @jackofallops - overall looks good and i have soe minor comments i've left inline

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.

hey @jackofallops

On the whole this looks pretty good - I've taken a look through and left some comments inline, but if we can fix those up then this should be otherwise good to go 👍

Thanks!

azurerm/internal/services/subscription/client/client.go Outdated Show resolved Hide resolved
website/docs/r/subscription.html.markdown Outdated Show resolved Hide resolved
website/docs/r/subscription.html.markdown Outdated Show resolved Hide resolved
website/docs/r/subscription.html.markdown Show resolved Hide resolved
website/docs/r/subscription.html.markdown Outdated Show resolved Hide resolved
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.

Taking a look through on the whole this looks pretty good - but we should update this to use the ID's of these items rather than the Name's, since there's different scopes/options for Billings Accounts etc, which'd help us differentiate these in the future

website/docs/r/subscription.html.markdown Show resolved Hide resolved
website/docs/r/subscription.html.markdown Show resolved Hide resolved
website/docs/r/subscription.html.markdown Outdated Show resolved Hide resolved
website/docs/r/subscription.html.markdown Outdated Show resolved Hide resolved
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.

hey @jackofallops

Thanks for pushing those changes - I've left some more comments inline but this otherwise LGTM 👍

website/docs/d/billing_mca_account_scope.html.markdown Outdated Show resolved Hide resolved
website/docs/r/subscription.html.markdown Show resolved Hide resolved
website/docs/r/subscription.html.markdown Show resolved Hide resolved
website/docs/r/subscription.html.markdown Outdated Show resolved Hide resolved
@jackofallops jackofallops merged commit 9289659 into master Mar 4, 2021
@jackofallops jackofallops deleted the r/subscription-resource branch March 4, 2021 19:24
jackofallops added a commit that referenced this pull request Mar 4, 2021
@ghost
Copy link

ghost commented Mar 5, 2021

This has been released in version 2.50.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.50.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Apr 4, 2021

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 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Apr 4, 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.

Create subscriptions programmatically using Azure Resource Manager
3 participants