Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cloud identity group #2224

Merged
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
6 changes: 6 additions & 0 deletions .changelog/3696.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:new-resource
`google_cloud_identity_group` (TPGB-only)
```
```release-note:note
added the `https://www.googleapis.com/auth/cloud-identity` scope to the provider by default
```
4 changes: 4 additions & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type Config struct {
BinaryAuthorizationBasePath string
CloudBuildBasePath string
CloudFunctionsBasePath string
CloudIdentityBasePath string
CloudIotBasePath string
CloudRunBasePath string
CloudSchedulerBasePath string
Expand Down Expand Up @@ -244,6 +245,7 @@ var BillingDefaultBasePath = "https://billingbudgets.googleapis.com/v1beta1/"
var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1/"
var CloudBuildDefaultBasePath = "https://cloudbuild.googleapis.com/v1/"
var CloudFunctionsDefaultBasePath = "https://cloudfunctions.googleapis.com/v1/"
var CloudIdentityDefaultBasePath = "https://cloudidentity.googleapis.com/v1beta1/"
var CloudIotDefaultBasePath = "https://cloudiot.googleapis.com/v1/"
var CloudRunDefaultBasePath = "https://{{location}}-run.googleapis.com/"
var CloudSchedulerDefaultBasePath = "https://cloudscheduler.googleapis.com/v1/"
Expand Down Expand Up @@ -292,6 +294,7 @@ var VPCAccessDefaultBasePath = "https://vpcaccess.googleapis.com/v1/"
var defaultClientScopes = []string{
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-identity",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/userinfo.email",
Expand Down Expand Up @@ -772,6 +775,7 @@ func ConfigureBasePaths(c *Config) {
c.BinaryAuthorizationBasePath = BinaryAuthorizationDefaultBasePath
c.CloudBuildBasePath = CloudBuildDefaultBasePath
c.CloudFunctionsBasePath = CloudFunctionsDefaultBasePath
c.CloudIdentityBasePath = CloudIdentityDefaultBasePath
c.CloudIotBasePath = CloudIotDefaultBasePath
c.CloudRunBasePath = CloudRunDefaultBasePath
c.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath
Expand Down
15 changes: 13 additions & 2 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ func Provider() terraform.ResourceProvider {
"GOOGLE_CLOUD_FUNCTIONS_CUSTOM_ENDPOINT",
}, CloudFunctionsDefaultBasePath),
},
"cloud_identity_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_CLOUD_IDENTITY_CUSTOM_ENDPOINT",
}, CloudIdentityDefaultBasePath),
},
"cloud_iot_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -663,9 +671,9 @@ func Provider() terraform.ResourceProvider {
return provider
}

// Generated resources: 165
// Generated resources: 167
// Generated IAM resources: 66
// Total generated resources: 231
// Total generated resources: 233
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -705,6 +713,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_cloudfunctions_function_iam_binding": ResourceIamBinding(CloudFunctionsCloudFunctionIamSchema, CloudFunctionsCloudFunctionIamUpdaterProducer, CloudFunctionsCloudFunctionIdParseFunc),
"google_cloudfunctions_function_iam_member": ResourceIamMember(CloudFunctionsCloudFunctionIamSchema, CloudFunctionsCloudFunctionIamUpdaterProducer, CloudFunctionsCloudFunctionIdParseFunc),
"google_cloudfunctions_function_iam_policy": ResourceIamPolicy(CloudFunctionsCloudFunctionIamSchema, CloudFunctionsCloudFunctionIamUpdaterProducer, CloudFunctionsCloudFunctionIdParseFunc),
"google_cloud_identity_group": resourceCloudIdentityGroup(),
"google_cloud_identity_group_membership": resourceCloudIdentityGroupMembership(),
"google_cloudiot_registry": resourceCloudIotDeviceRegistry(),
"google_cloud_run_domain_mapping": resourceCloudRunDomainMapping(),
"google_cloud_run_service": resourceCloudRunService(),
Expand Down Expand Up @@ -1085,6 +1095,7 @@ func providerConfigure(d *schema.ResourceData, p *schema.Provider, terraformVers
config.BinaryAuthorizationBasePath = d.Get("binary_authorization_custom_endpoint").(string)
config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string)
config.CloudFunctionsBasePath = d.Get("cloud_functions_custom_endpoint").(string)
config.CloudIdentityBasePath = d.Get("cloud_identity_custom_endpoint").(string)
config.CloudIotBasePath = d.Get("cloud_iot_custom_endpoint").(string)
config.CloudRunBasePath = d.Get("cloud_run_custom_endpoint").(string)
config.CloudSchedulerBasePath = d.Get("cloud_scheduler_custom_endpoint").(string)
Expand Down
16 changes: 16 additions & 0 deletions google-beta/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ var orgEnvVars = []string{
"GOOGLE_ORG",
}

var custIdEnvVars = []string{
"GOOGLE_CUST_ID",
}

var identityUserEnvVars = []string{
"GOOGLE_IDENTITY_USER",
}

var orgEnvDomainVars = []string{
"GOOGLE_ORG_DOMAIN",
}
Expand Down Expand Up @@ -837,6 +845,14 @@ func getTestZoneFromEnv() string {
return multiEnvSearch(zoneEnvVars)
}

func getTestCustIdFromEnv(t *testing.T) string {
return multiEnvSearch(custIdEnvVars)
}

func getTestIdentityUserFromEnv(t *testing.T) string {
return multiEnvSearch(identityUserEnvVars)
}

// Firestore can't be enabled at the same time as Datastore, so we need a new
// project to manage it until we can enable Firestore programmatically.
func getTestFirestoreProjectFromEnv(t *testing.T) string {
Expand Down
10 changes: 9 additions & 1 deletion google-beta/resource_bigquery_data_transfer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,15 @@ func resourceBigqueryDataTransferConfigCreate(d *schema.ResourceData, meta inter
// `name` is autogenerated from the api so needs to be set post-create
name, ok := res["name"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
respBody, ok := res["response"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
}

name, ok = respBody.(map[string]interface{})["name"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
}
}
d.Set("name", name.(string))
d.SetId(name.(string))
Expand Down
10 changes: 9 additions & 1 deletion google-beta/resource_billing_budget.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,15 @@ func resourceBillingBudgetCreate(d *schema.ResourceData, meta interface{}) error
// `name` is autogenerated from the api so needs to be set post-create
name, ok := res["name"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
respBody, ok := res["response"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
}

name, ok = respBody.(map[string]interface{})["name"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
}
}
d.Set("name", name.(string))
d.SetId(name.(string))
Expand Down
Loading