Skip to content

Commit

Permalink
Baseline Patch
Browse files Browse the repository at this point in the history
* Cleared up README.md
* Added Input and Output Descriptions
  • Loading branch information
Adam Coulter authored Aug 11, 2020
1 parent cd82982 commit 89dfe15
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 43 deletions.
52 changes: 13 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
## Requirements
## Additional Requirements

The following requirements are needed by this module:
### Required Permissions

- terraform (>= 0.13)
- azurerm (~> 2.19)
- shell (~>1.7)
The user or service principal executing this module requires the ability to create subscriptions against an Azure Enrollment Account (`Owner` role). See the [Azure Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/grant-access-to-create-subscription?#grant-access) for how to grant this.

As this module uses the Az PowerShell commands it requires you set the azurerm provider config using environment variables so it can authenticate.
### PowerShell Dependencies

Additional PowerShell Requirements:
As this module uses the Az PowerShell commands it requires that the azurerm provider config is set using environment variables so it can authenticate. These modules are required to be installed on the deployment agent:

- PowerShell Core (~>7.0)
- PS Module: Az (~>4.5)
Expand All @@ -19,36 +17,12 @@ Additional PowerShell Requirements:
Install-Module @("Az", "Az.Accounts", "Az.Subscription")
```

## Providers

The following providers are used by this module:

- azurerm (~> 2.19)
- shell (~>1.7)

## Required Inputs

The following input variables are required:

### name

Description: Subscription name

Type: `string`

## Optional Inputs

The following input variables are optional (have default values):

### type

Description: Prod or DevTest

Type: `string`

Default: `"Prod"`

## Outputs

No output.
## Usage Example

```hcl
module "subscription" {
source = "servian/subscription/azurerm"
name = "My Subscription"
type = "Prod"
}
```
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "shell_script" "subscription" {
}
}

resource "azurerm_role_assignment" "test" {
resource "azurerm_role_assignment" "owners" {
for_each = toset(var.principal_ids)
scope = "/subscriptions/${shell_script.subscription.output.id}"
role_definition_name = "Owner"
Expand Down
8 changes: 7 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
output "id" {
output "subscription_id" {
value = shell_script.subscription.output.id
description = "Subscription ID GUID"
}

output "id" {
value = "/subscriptions/${shell_script.subscription.output.id}"
description = "Azure resource model subscription path"
}
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
variable "name" {
type = string
description = "Subscription name"
description = "Subscription name, can be changed later without recreating the subscription."
}

variable "type" {
type = string
description = "Prod or DevTest"
description = "Subscription offer types 'Prod' or 'DevTest', 'DevTest' must first be enabled at the enrollment account, otherwise will fail."
default = "Prod"
validation {
condition = contains(["Prod", "DevTest"], var.type)
Expand Down

0 comments on commit 89dfe15

Please sign in to comment.