Skip to content

Commit afe58e1

Browse files
authored
License config (#15280)
1 parent 439123e commit afe58e1

File tree

3 files changed

+253
-0
lines changed

3 files changed

+253
-0
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: 'LicenseConfig'
16+
description: |
17+
License Configuration.
18+
references:
19+
api: 'https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.licenseConfigs'
20+
base_url: 'projects/{{project}}/locations/{{location}}/licenseConfigs'
21+
self_link: 'projects/{{project}}/locations/{{location}}/licenseConfigs/{{license_config_id}}'
22+
create_url: 'projects/{{project}}/locations/{{location}}/licenseConfigs?licenseConfigId={{license_config_id}}'
23+
update_verb: 'PATCH'
24+
update_mask: true
25+
exclude_delete: true
26+
import_format:
27+
- 'projects/{{project}}/locations/{{location}}/licenseConfigs/{{license_config_id}}'
28+
timeouts:
29+
insert_minutes: 5
30+
update_minutes: 5
31+
examples:
32+
- name: 'discoveryengine_licenseconfig_basic'
33+
primary_resource_id: 'basic'
34+
vars:
35+
license_config_id: 'license-config-id'
36+
parameters:
37+
- name: 'location'
38+
type: String
39+
description: |
40+
The geographic location where the data store should reside. The value can
41+
only be one of "global", "us" and "eu".
42+
url_param_only: true
43+
required: true
44+
immutable: true
45+
- name: 'licenseConfigId'
46+
type: String
47+
description: |
48+
The unique id of the license config.
49+
url_param_only: true
50+
required: true
51+
immutable: true
52+
properties:
53+
- name: 'name'
54+
type: String
55+
description: |
56+
The unique full resource name of the license config. Values are of the format
57+
`projects/{project}/locations/{location}/licenseConfigs/{license_config}`.
58+
output: true
59+
- name: 'licenseCount'
60+
type: Integer
61+
description: |
62+
Number of licenses purchased.
63+
required: true
64+
- name: 'subscriptionTier'
65+
type: Enum
66+
description: |
67+
Subscription tier information for the license config.
68+
required: true
69+
enum_values:
70+
- 'SUBSCRIPTION_TIER_UNSPECIFIED'
71+
- 'SUBSCRIPTION_TIER_SEARCH'
72+
- 'SUBSCRIPTION_TIER_SEARCH_AND_ASSISTANT'
73+
- 'SUBSCRIPTION_TIER_NOTEBOOK_LM'
74+
- 'SUBSCRIPTION_TIER_FRONTLINE_WORKER'
75+
- 'SUBSCRIPTION_TIER_AGENTSPACE_STARTER'
76+
- 'SUBSCRIPTION_TIER_AGENTSPACE_BUSINESS'
77+
- 'SUBSCRIPTION_TIER_ENTERPRISE'
78+
- 'SUBSCRIPTION_TIER_EDU'
79+
- 'SUBSCRIPTION_TIER_EDU_PRO'
80+
- name: 'autoRenew'
81+
type: Boolean
82+
description: |
83+
Whether the license config should be auto renewed when it reaches the end date.
84+
- name: 'startDate'
85+
type: NestedObject
86+
description: |
87+
The start date.
88+
required: true
89+
properties:
90+
- name: 'year'
91+
type: Integer
92+
description:
93+
Year of the date. Must be from 1 to
94+
9999, or 0 to specify a date without a
95+
year.
96+
- name: 'month'
97+
type: Integer
98+
description:
99+
Month of a year. Must be from 1 to 12,
100+
or 0 to specify a year without a month
101+
and day.
102+
- name: 'day'
103+
type: Integer
104+
description:
105+
Day of a month. Must be from 1 to 31
106+
and valid for the year and month, or 0
107+
to specify a year by itself or a year
108+
and month where the day isn't
109+
significant.
110+
- name: 'endDate'
111+
type: NestedObject
112+
description: |
113+
The planned end date.
114+
properties:
115+
- name: 'year'
116+
type: Integer
117+
description:
118+
Year of the date. Must be from 1 to
119+
9999, or 0 to specify a date without a
120+
year.
121+
- name: 'month'
122+
type: Integer
123+
description:
124+
Month of a year. Must be from 1 to 12,
125+
or 0 to specify a year without a month
126+
and day.
127+
- name: 'day'
128+
type: Integer
129+
description:
130+
Day of a month. Must be from 1 to 31
131+
and valid for the year and month, or 0
132+
to specify a year by itself or a year
133+
and month where the day isn't
134+
significant.
135+
- name: 'subscriptionTerm'
136+
type: Enum
137+
description: |
138+
Subscription term.
139+
required: true
140+
enum_values:
141+
- 'SUBSCRIPTION_TERM_UNSPECIFIED'
142+
- 'SUBSCRIPTION_TERM_ONE_MONTH'
143+
- 'SUBSCRIPTION_TERM_ONE_YEAR'
144+
- 'SUBSCRIPTION_TERM_THREE_YEARS'
145+
- 'SUBSCRIPTION_TERM_THREE_MONTHS'
146+
- 'SUBSCRIPTION_TERM_FOURTEEN_DAYS'
147+
- 'SUBSCRIPTION_TERM_CUSTOM'
148+
- name: 'freeTrial'
149+
type: Boolean
150+
description: |
151+
Whether the license config is for free trial.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "google_discovery_engine_license_config" "basic" {
2+
location = "global"
3+
license_config_id = "{{index $.Vars "license_config_id"}}"
4+
license_count = 50
5+
subscription_tier = "SUBSCRIPTION_TIER_SEARCH_AND_ASSISTANT"
6+
start_date {
7+
year = 2099
8+
month = 1
9+
day = 1
10+
}
11+
end_date {
12+
year = 2100
13+
month = 1
14+
day = 1
15+
}
16+
subscription_term = "SUBSCRIPTION_TERM_ONE_YEAR"
17+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package discoveryengine_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
7+
"github.com/hashicorp/terraform-provider-google/google/acctest"
8+
)
9+
10+
func TestAccDiscoveryEngineLicenseConfig_discoveryengineLicenseconfigBasicExample_update(t *testing.T) {
11+
t.Parallel()
12+
13+
context := map[string]interface{}{
14+
"random_suffix": acctest.RandString(t, 10),
15+
}
16+
17+
acctest.VcrTest(t, resource.TestCase{
18+
PreCheck: func() { acctest.AccTestPreCheck(t) },
19+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
20+
Steps: []resource.TestStep{
21+
{
22+
Config: testAccDiscoveryEngineLicenseConfig_discoveryengineLicenseconfigBasicExample_basic(context),
23+
},
24+
{
25+
ResourceName: "google_discovery_engine_license_config.basic",
26+
ImportState: true,
27+
ImportStateVerify: true,
28+
ImportStateVerifyIgnore: []string{"location"},
29+
},
30+
{
31+
Config: testAccDiscoveryEngineLicenseConfig_discoveryengineLicenseconfigBasicExample_update(context),
32+
},
33+
{
34+
ResourceName: "google_discovery_engine_license_config.basic",
35+
ImportState: true,
36+
ImportStateVerify: true,
37+
ImportStateVerifyIgnore: []string{"location"},
38+
},
39+
},
40+
})
41+
}
42+
43+
func testAccDiscoveryEngineLicenseConfig_discoveryengineLicenseconfigBasicExample_basic(context map[string]interface{}) string {
44+
return acctest.Nprintf(`
45+
resource "google_discovery_engine_license_config" "basic" {
46+
location = "global"
47+
license_config_id = "tf-test-license-config-id%{random_suffix}"
48+
license_count = 50
49+
subscription_tier = "SUBSCRIPTION_TIER_SEARCH_AND_ASSISTANT"
50+
start_date {
51+
year = 2099
52+
month = 1
53+
day = 1
54+
}
55+
end_date {
56+
year = 2100
57+
month = 1
58+
day = 1
59+
}
60+
subscription_term = "SUBSCRIPTION_TERM_ONE_YEAR"
61+
}
62+
`, context)
63+
}
64+
65+
func testAccDiscoveryEngineLicenseConfig_discoveryengineLicenseconfigBasicExample_update(context map[string]interface{}) string {
66+
return acctest.Nprintf(`
67+
resource "google_discovery_engine_license_config" "basic" {
68+
location = "global"
69+
license_config_id = "tf-test-license-config-id%{random_suffix}"
70+
license_count = 51
71+
subscription_tier = "SUBSCRIPTION_TIER_SEARCH_AND_ASSISTANT"
72+
start_date {
73+
year = 2099
74+
month = 1
75+
day = 1
76+
}
77+
end_date {
78+
year = 2100
79+
month = 1
80+
day = 1
81+
}
82+
subscription_term = "SUBSCRIPTION_TERM_ONE_YEAR"
83+
}
84+
`, context)
85+
}

0 commit comments

Comments
 (0)