Skip to content

This terraform module manages subscriptions for CSP and Enterprise agreements.

License

Notifications You must be signed in to change notification settings

schubergphilis/terraform-azure-mcaf-svm

Repository files navigation

terraform-azure-mcaf-svm-csp

This terraform module will be able to manage subscriptions for CSP and Enterprise agreements.

How to work with the CSP configuration

you need to configure the restful provider. make sure to ask the saas team to whitelist your outgoing ip.

provider "restful" {
  base_url = "https://your-csp-app-uri-here"

  header = {
    Content-Type = "application/json"
  }

  security = {
    apikey = [
      {
        in    = "header"
        name  = "x-functions-key"
        value = "x-functions-value"
      },
      {
        in    = "header"
        name  = "x-customer-key"
        value = "x-customer-value"
      },
    ]
  }
}

for variables, you need to provide a sku as well, the default is Production, which translates to 0001, which is fine, setting to DevTest translates to 0002.

the following options are available:

"enabledAzurePlans": [
  {
    "skuId": "0001",
    "skuDescription": "Microsoft Azure Plan"
  }
  {
    "skuId": "0002",
    "skuDescription": "Microsoft Azure Plan for DevTest"
  },
]

How to work with the EA configuration

  1. login with your credentials
az login -t your-tenant-id-here
az billing account list --query "[].id"
# or
$AccountName = (az billing account list --query "[].id" -o json) | ConvertFrom-Json

The output will give you your account name if you want to see all details, remove the query part.

  1. check your billing information
az billing profile list --account-name $AccountName --expand "InvoiceSections" --query "[].invoiceSections[].value[].id"

Requirements

Name Version
terraform ~> 1.7
azapi 2.0.1
azurerm ~> 4.0
restful 0.14.0

Providers

Name Version
azapi 2.0.1
azurerm ~> 4.0
restful 0.14.0

Modules

No modules.

Resources

Name Type
azapi_resource.subscription resource
azurerm_management_group_subscription_association.this resource
restful_operation.subscription resource
azurerm_billing_mca_account_scope.this data source
azurerm_client_config.current data source
azurerm_subscriptions.this data source

Inputs

Name Description Type Default Required
channel Billing channel to be used by the subscription string n/a yes
name Name of the Subscription to be created string n/a yes
billing_account_name The name of the billing account, only needed if channel is set to ea string null no
billing_profile_name The name of the billing profile, only needed if channel is set to ea string null no
invoice_section_name The name of the invoice section, only needed if channel is set to ea string null no
owner_id Id of the subscription owner, only needed if channel is set to ea. string null no
parent_management_group_id The Id of the parent management group, only needed if channel is set to ea string null no
sku Type of subscription to create string "Production" no
tags Tags to add to the subscription, only needed if channel is set to ea. map(string) null no

Outputs

Name Description
subscription Created subscription details

License

Copyright: Schuberg Philis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

This terraform module manages subscriptions for CSP and Enterprise agreements.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages