Skip to content

Commit cb4d099

Browse files
Added tag value resource (#4603) (#3097)
* Added tag value resource * Copied tag key tests and adjusted for values * Corrected duplicate map keys * Added validation to shortnames and descriptions * Renamed tags tests since they're no longer tag-key-only Signed-off-by: Modular Magician <[email protected]>
1 parent 950f2d7 commit cb4d099

File tree

9 files changed

+970
-163
lines changed

9 files changed

+970
-163
lines changed

.changelog/4603.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_tags_tag_value`
3+
```

google-beta/provider.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,9 @@ func Provider() *schema.Provider {
844844
return provider
845845
}
846846

847-
// Generated resources: 217
847+
// Generated resources: 218
848848
// Generated IAM resources: 111
849-
// Total generated resources: 328
849+
// Total generated resources: 329
850850
func ResourceMap() map[string]*schema.Resource {
851851
resourceMap, _ := ResourceMapWithErrors()
852852
return resourceMap
@@ -1180,6 +1180,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
11801180
"google_storage_default_object_access_control": resourceStorageDefaultObjectAccessControl(),
11811181
"google_storage_hmac_key": resourceStorageHmacKey(),
11821182
"google_tags_tag_key": resourceTagsTagKey(),
1183+
"google_tags_tag_value": resourceTagsTagValue(),
11831184
"google_tpu_node": resourceTPUNode(),
11841185
"google_vpc_access_connector": resourceVPCAccessConnector(),
11851186
"google_workflows_workflow": resourceWorkflowsWorkflow(),

google-beta/resource_tags_tag_key.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"time"
2323

2424
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
25+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
2526
)
2627

2728
func resourceTagsTagKey() *schema.Resource {
@@ -49,17 +50,19 @@ func resourceTagsTagKey() *schema.Resource {
4950
Description: `Input only. The resource name of the new TagKey's parent. Must be of the form organizations/{org_id}.`,
5051
},
5152
"short_name": {
52-
Type: schema.TypeString,
53-
Required: true,
54-
ForceNew: true,
53+
Type: schema.TypeString,
54+
Required: true,
55+
ForceNew: true,
56+
ValidateFunc: validation.StringLenBetween(1, 63),
5557
Description: `Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace.
5658
5759
The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.`,
5860
},
5961
"description": {
60-
Type: schema.TypeString,
61-
Optional: true,
62-
Description: `User-assigned description of the TagKey. Must not exceed 256 characters.`,
62+
Type: schema.TypeString,
63+
Optional: true,
64+
ValidateFunc: validation.StringLenBetween(0, 256),
65+
Description: `User-assigned description of the TagKey. Must not exceed 256 characters.`,
6366
},
6467
"create_time": {
6568
Type: schema.TypeString,

google-beta/resource_tags_tag_key_test.go

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)