Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions mmv1/products/licensemanager/Configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2026 Google Inc.
# 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.

---
name: Configuration
description: Configuration resource for License Manager
base_url: projects/{{project}}/locations/{{location}}/configurations
self_link: projects/{{project}}/locations/{{location}}/configurations/{{configuration_id}}
create_url: projects/{{project}}/locations/{{location}}/configurations?configurationId={{configuration_id}}
update_mask: true
update_verb: PATCH
import_format:
- projects/{{project}}/locations/{{location}}/configurations/{{configuration_id}}
examples:
- name: licensemanager_configuration_basic
primary_resource_id: "example-configuration"
vars:
configuration_id: "example-configuration"
product: "products/my-product"
license_count: 10
async:
operation:
base_url: '{{op_id}}'
actions:
- create
- update
- delete
result:
resource_inside_response: true
autogen_status: Q29uZmlndXJhdGlvbg==
autogen_async: true
custom_code:
encoder: 'templates/terraform/encoders/licensemanager_configuration.go.tmpl'
post_read: 'templates/terraform/post_read/licensemanager_configuration.go.tmpl'
parameters:
- name: location
type: String
required: true
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
immutable: true
url_param_only: true
- name: configurationId
type: String
required: true
description: Id of the requesting object
immutable: true
url_param_only: true
properties:
- name: createTime
type: String
description: '[Output only] Create time stamp'
output: true
- name: name
type: String
description: Identifier. name of resource
output: true
- name: state
type: String
description: |-
State of the configuration.
output: true
- name: updateTime
type: String
description: '[Output only] Update time stamp'
output: true
- name: labels
type: KeyValueLabels
description: Labels as key value pairs
- name: product
type: String
required: true
description: Name field (with URL) of the Product offered for SPLA.
- name: licenseCount
type: Integer
required: true
description: Number of units to bill for.
23 changes: 23 additions & 0 deletions mmv1/products/licensemanager/product.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Google Inc.
# 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.

---
name: LicenseManager
display_name: License Manager
scopes:
- https://www.googleapis.com/auth/cloud-platform
versions:
- base_url: https://licensemanager.googleapis.com/v1/
name: ga
- base_url: https://licensemanager.googleapis.com/v1alpha/
name: beta
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
product := obj["product"].(string)
count := obj["licenseCount"].(int64)

licenseType := "LICENSE_TYPE_PER_MONTH_PER_USER"
if product == "MicrosoftSQLServer2022Enterprise" {
licenseType = "LICENSE_TYPE_PER_MONTH_PER_PACK"
}

obj["licenseType"] = licenseType

billingInfo := map[string]interface{}{}
if licenseType == "LICENSE_TYPE_PER_MONTH_PER_USER" {
billingInfo["userCountBilling"] = map[string]interface{}{
"userCount": count,
}
} else if licenseType == "LICENSE_TYPE_PER_MONTH_PER_PACK" {
billingInfo["packCountBilling"] = map[string]interface{}{
"packCount": count,
}
}

obj["currentBillingInfo"] = billingInfo
obj["nextBillingInfo"] = billingInfo

if _, ok := obj["displayName"]; !ok {
obj["displayName"] = "Managed by Terraform"
}

delete(obj, "licenseCount")
return obj, nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "google_licensemanager_configuration" "{{$.PrimaryResourceId}}" {
location = "us-central1"
configuration_id = "{{index $.Vars "configuration_id"}}"
product = "{{index $.Vars "product"}}"
license_count = {{index $.Vars "license_count"}}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
billingInfo, ok := res["currentBillingInfo"].(map[string]interface{})
if ok {
if userCountBilling, ok := billingInfo["userCountBilling"].(map[string]interface{}); ok {
if err := d.Set("licenseCount", userCountBilling["userCount"]); err != nil {
return fmt.Errorf("Error setting count: %s", err)
}
} else if packCountBilling, ok := billingInfo["packCountBilling"].(map[string]interface{}); ok {
if err := d.Set("licenseCount", packCountBilling["packCount"]); err != nil {
return fmt.Errorf("Error setting count: %s", err)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,11 @@ var ServicesListBeta = mapOf(
"displayName" to "Kms",
"path" to "./google-beta/services/kms"
),
"licensemanager" to mapOf(
"name" to "licensemanager",
"displayName" to "License Manager",
"path" to "./google/services/licensemanager"
),
"logging" to mapOf(
"name" to "logging",
"displayName" to "Logging",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,11 @@ var ServicesListGa = mapOf(
"displayName" to "Kms",
"path" to "./google/services/kms"
),
"licensemanager" to mapOf(
"name" to "licensemanager",
"displayName" to "License Manager",
"path" to "./google/services/licensemanager"
),
"logging" to mapOf(
"name" to "logging",
"displayName" to "Logging",
Expand Down
Loading