Skip to content

Commit

Permalink
Add support for InitialGroupConfig to google_cloud_identity_group (#4746
Browse files Browse the repository at this point in the history
) (#9035)

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Apr 29, 2021
1 parent d52c5b2 commit bc66669
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/4746.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
cloud_identity: add support for `initial_group_config` to the google_cloud_identity_group resource
```
15 changes: 14 additions & 1 deletion google/resource_cloud_identity_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

func resourceCloudIdentityGroup() *schema.Resource {
Expand Down Expand Up @@ -112,6 +113,18 @@ Must not be longer than 4,096 characters.`,
Optional: true,
Description: `The display name of the Group.`,
},
"initial_group_config": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"INITIAL_GROUP_CONFIG_UNSPECIFIED", "WITH_INITIAL_OWNER", "EMPTY", ""}, false),
Description: `The initial configuration options for creating a Group.
See the
[API reference](https://cloud.google.com/identity/docs/reference/rest/v1beta1/groups/create#initialgroupconfig)
for possible values. Default value: "EMPTY" Possible values: ["INITIAL_GROUP_CONFIG_UNSPECIFIED", "WITH_INITIAL_OWNER", "EMPTY"]`,
Default: "EMPTY",
},
"create_time": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -172,7 +185,7 @@ func resourceCloudIdentityGroupCreate(d *schema.ResourceData, meta interface{})
obj["labels"] = labelsProp
}

url, err := replaceVars(d, config, "{{CloudIdentityBasePath}}groups?initialGroupConfig=EMPTY")
url, err := replaceVars(d, config, "{{CloudIdentityBasePath}}groups?initialGroupConfig={{initial_group_config}}")
if err != nil {
return err
}
Expand Down
10 changes: 6 additions & 4 deletions google/resource_cloud_identity_group_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ func TestAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(t *testing.T) {
Config: testAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(context),
},
{
ResourceName: "google_cloud_identity_group.cloud_identity_group_basic",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_cloud_identity_group.cloud_identity_group_basic",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"initial_group_config"},
},
},
})
Expand All @@ -52,7 +53,8 @@ func TestAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(t *testing.T) {
func testAccCloudIdentityGroup_cloudIdentityGroupsBasicExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_cloud_identity_group" "cloud_identity_group_basic" {
display_name = "tf-test-my-identity-group%{random_suffix}"
display_name = "tf-test-my-identity-group%{random_suffix}"
initial_group_config = "WITH_INITIAL_OWNER"
parent = "customers/%{cust_id}"
Expand Down
12 changes: 11 additions & 1 deletion website/docs/r/cloud_identity_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Your account must have the `serviceusage.services.use` permission on the

```hcl
resource "google_cloud_identity_group" "cloud_identity_group_basic" {
display_name = "my-identity-group"
display_name = "my-identity-group"
initial_group_config = "WITH_INITIAL_OWNER"
parent = "customers/A01b123xz"
Expand Down Expand Up @@ -118,6 +119,15 @@ The `group_key` block supports:
An extended description to help users determine the purpose of a Group.
Must not be longer than 4,096 characters.

* `initial_group_config` -
(Optional)
The initial configuration options for creating a Group.
See the
[API reference](https://cloud.google.com/identity/docs/reference/rest/v1beta1/groups/create#initialgroupconfig)
for possible values.
Default value is `EMPTY`.
Possible values are `INITIAL_GROUP_CONFIG_UNSPECIFIED`, `WITH_INITIAL_OWNER`, and `EMPTY`.


## Attributes Reference

Expand Down

0 comments on commit bc66669

Please sign in to comment.