diff --git a/.changelog/6551.txt b/.changelog/6551.txt new file mode 100644 index 0000000000..e447825b10 --- /dev/null +++ b/.changelog/6551.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +`google_datastream_private_connection` +``` diff --git a/google-beta/provider.go b/google-beta/provider.go index ef8f072cfa..5cdff7e7e7 100644 --- a/google-beta/provider.go +++ b/google-beta/provider.go @@ -952,9 +952,9 @@ func Provider() *schema.Provider { return provider } -// Generated resources: 261 +// Generated resources: 262 // Generated IAM resources: 171 -// Total generated resources: 432 +// Total generated resources: 433 func ResourceMap() map[string]*schema.Resource { resourceMap, _ := ResourceMapWithErrors() return resourceMap @@ -1206,6 +1206,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_dataproc_metastore_federation_iam_policy": ResourceIamPolicy(DataprocMetastoreFederationIamSchema, DataprocMetastoreFederationIamUpdaterProducer, DataprocMetastoreFederationIdParseFunc), "google_datastore_index": resourceDatastoreIndex(), "google_datastream_connection_profile": resourceDatastreamConnectionProfile(), + "google_datastream_private_connection": resourceDatastreamPrivateConnection(), "google_deployment_manager_deployment": resourceDeploymentManagerDeployment(), "google_dialogflow_agent": resourceDialogflowAgent(), "google_dialogflow_intent": resourceDialogflowIntent(), diff --git a/google-beta/resource_datastream_private_connection.go b/google-beta/resource_datastream_private_connection.go new file mode 100644 index 0000000000..e3820c2a79 --- /dev/null +++ b/google-beta/resource_datastream_private_connection.go @@ -0,0 +1,391 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "fmt" + "log" + "reflect" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func resourceDatastreamPrivateConnection() *schema.Resource { + return &schema.Resource{ + Create: resourceDatastreamPrivateConnectionCreate, + Read: resourceDatastreamPrivateConnectionRead, + Delete: resourceDatastreamPrivateConnectionDelete, + + Importer: &schema.ResourceImporter{ + State: resourceDatastreamPrivateConnectionImport, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + "display_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `Display name.`, + }, + "location": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The name of the location this repository is located in.`, + }, + "private_connection_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The private connectivity identifier.`, + }, + "vpc_peering_config": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: `The VPC Peering configuration is used to create VPC peering +between Datastream and the consumer's VPC.`, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "subnet": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `A free subnet for peering. (CIDR of /29)`, + }, + "vpc": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `Fully qualified name of the VPC that Datastream will peer to. +Format: projects/{project}/global/{networks}/{name}`, + }, + }, + }, + }, + "labels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: `Labels.`, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: `The resource's name.`, + }, + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + UseJSONNumber: true, + } +} + +func resourceDatastreamPrivateConnectionCreate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + userAgent, err := generateUserAgentString(d, config.userAgent) + if err != nil { + return err + } + + obj := make(map[string]interface{}) + labelsProp, err := expandDatastreamPrivateConnectionLabels(d.Get("labels"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) { + obj["labels"] = labelsProp + } + displayNameProp, err := expandDatastreamPrivateConnectionDisplayName(d.Get("display_name"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("display_name"); !isEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { + obj["displayName"] = displayNameProp + } + vpcPeeringConfigProp, err := expandDatastreamPrivateConnectionVPCPeeringConfig(d.Get("vpc_peering_config"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("vpc_peering_config"); !isEmptyValue(reflect.ValueOf(vpcPeeringConfigProp)) && (ok || !reflect.DeepEqual(v, vpcPeeringConfigProp)) { + obj["vpcPeeringConfig"] = vpcPeeringConfigProp + } + + url, err := replaceVars(d, config, "{{DatastreamBasePath}}projects/{{project}}/locations/{{location}}/privateConnections?privateConnectionId={{private_connection_id}}") + if err != nil { + return err + } + + log.Printf("[DEBUG] Creating new PrivateConnection: %#v", obj) + billingProject := "" + + project, err := getProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for PrivateConnection: %s", err) + } + billingProject = project + + // err == nil indicates that the billing_project value was found + if bp, err := getBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := sendRequestWithTimeout(config, "POST", billingProject, url, userAgent, obj, d.Timeout(schema.TimeoutCreate)) + if err != nil { + return fmt.Errorf("Error creating PrivateConnection: %s", err) + } + + // Store the ID now + id, err := replaceVars(d, config, "projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + // Use the resource in the operation response to populate + // identity fields and d.Id() before read + var opRes map[string]interface{} + err = datastreamOperationWaitTimeWithResponse( + config, res, &opRes, project, "Creating PrivateConnection", userAgent, + d.Timeout(schema.TimeoutCreate)) + if err != nil { + // The resource didn't actually create + d.SetId("") + return fmt.Errorf("Error waiting to create PrivateConnection: %s", err) + } + + if err := d.Set("name", flattenDatastreamPrivateConnectionName(opRes["name"], d, config)); err != nil { + return err + } + + // This may have caused the ID to update - update it if so. + id, err = replaceVars(d, config, "projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + log.Printf("[DEBUG] Finished creating PrivateConnection %q: %#v", d.Id(), res) + + return resourceDatastreamPrivateConnectionRead(d, meta) +} + +func resourceDatastreamPrivateConnectionRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + userAgent, err := generateUserAgentString(d, config.userAgent) + if err != nil { + return err + } + + url, err := replaceVars(d, config, "{{DatastreamBasePath}}projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}") + if err != nil { + return err + } + + billingProject := "" + + project, err := getProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for PrivateConnection: %s", err) + } + billingProject = project + + // err == nil indicates that the billing_project value was found + if bp, err := getBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := sendRequest(config, "GET", billingProject, url, userAgent, nil) + if err != nil { + return handleNotFoundError(err, d, fmt.Sprintf("DatastreamPrivateConnection %q", d.Id())) + } + + if err := d.Set("project", project); err != nil { + return fmt.Errorf("Error reading PrivateConnection: %s", err) + } + + if err := d.Set("name", flattenDatastreamPrivateConnectionName(res["name"], d, config)); err != nil { + return fmt.Errorf("Error reading PrivateConnection: %s", err) + } + if err := d.Set("labels", flattenDatastreamPrivateConnectionLabels(res["labels"], d, config)); err != nil { + return fmt.Errorf("Error reading PrivateConnection: %s", err) + } + if err := d.Set("display_name", flattenDatastreamPrivateConnectionDisplayName(res["displayName"], d, config)); err != nil { + return fmt.Errorf("Error reading PrivateConnection: %s", err) + } + if err := d.Set("vpc_peering_config", flattenDatastreamPrivateConnectionVPCPeeringConfig(res["vpcPeeringConfig"], d, config)); err != nil { + return fmt.Errorf("Error reading PrivateConnection: %s", err) + } + + return nil +} + +func resourceDatastreamPrivateConnectionDelete(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + userAgent, err := generateUserAgentString(d, config.userAgent) + if err != nil { + return err + } + + billingProject := "" + + project, err := getProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for PrivateConnection: %s", err) + } + billingProject = project + + url, err := replaceVars(d, config, "{{DatastreamBasePath}}projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}") + if err != nil { + return err + } + + var obj map[string]interface{} + log.Printf("[DEBUG] Deleting PrivateConnection %q", d.Id()) + + // err == nil indicates that the billing_project value was found + if bp, err := getBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := sendRequestWithTimeout(config, "DELETE", billingProject, url, userAgent, obj, d.Timeout(schema.TimeoutDelete)) + if err != nil { + return handleNotFoundError(err, d, "PrivateConnection") + } + + err = datastreamOperationWaitTime( + config, res, project, "Deleting PrivateConnection", userAgent, + d.Timeout(schema.TimeoutDelete)) + + if err != nil { + return err + } + + log.Printf("[DEBUG] Finished deleting PrivateConnection %q: %#v", d.Id(), res) + return nil +} + +func resourceDatastreamPrivateConnectionImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + config := meta.(*Config) + if err := parseImportId([]string{ + "projects/(?P[^/]+)/locations/(?P[^/]+)/privateConnections/(?P[^/]+)", + "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", + "(?P[^/]+)/(?P[^/]+)", + }, d, config); err != nil { + return nil, err + } + + // Replace import id for the resource id + id, err := replaceVars(d, config, "projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}") + if err != nil { + return nil, fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + return []*schema.ResourceData{d}, nil +} + +func flattenDatastreamPrivateConnectionName(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenDatastreamPrivateConnectionLabels(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenDatastreamPrivateConnectionDisplayName(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenDatastreamPrivateConnectionVPCPeeringConfig(v interface{}, d *schema.ResourceData, config *Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["vpc"] = + flattenDatastreamPrivateConnectionVPCPeeringConfigVPC(original["vpc"], d, config) + transformed["subnet"] = + flattenDatastreamPrivateConnectionVPCPeeringConfigSubnet(original["subnet"], d, config) + return []interface{}{transformed} +} +func flattenDatastreamPrivateConnectionVPCPeeringConfigVPC(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenDatastreamPrivateConnectionVPCPeeringConfigSubnet(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func expandDatastreamPrivateConnectionLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { + if v == nil { + return map[string]string{}, nil + } + m := make(map[string]string) + for k, val := range v.(map[string]interface{}) { + m[k] = val.(string) + } + return m, nil +} + +func expandDatastreamPrivateConnectionDisplayName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandDatastreamPrivateConnectionVPCPeeringConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + l := v.([]interface{}) + if len(l) == 0 || l[0] == nil { + return nil, nil + } + raw := l[0] + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedVPC, err := expandDatastreamPrivateConnectionVPCPeeringConfigVPC(original["vpc"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedVPC); val.IsValid() && !isEmptyValue(val) { + transformed["vpc"] = transformedVPC + } + + transformedSubnet, err := expandDatastreamPrivateConnectionVPCPeeringConfigSubnet(original["subnet"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedSubnet); val.IsValid() && !isEmptyValue(val) { + transformed["subnet"] = transformedSubnet + } + + return transformed, nil +} + +func expandDatastreamPrivateConnectionVPCPeeringConfigVPC(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandDatastreamPrivateConnectionVPCPeeringConfigSubnet(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} diff --git a/google-beta/resource_datastream_private_connection_generated_test.go b/google-beta/resource_datastream_private_connection_generated_test.go new file mode 100644 index 0000000000..8ed498546a --- /dev/null +++ b/google-beta/resource_datastream_private_connection_generated_test.go @@ -0,0 +1,105 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccDatastreamPrivateConnection_datastreamPrivateConnectionFullExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": randString(t, 10), + } + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckDatastreamPrivateConnectionDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccDatastreamPrivateConnection_datastreamPrivateConnectionFullExample(context), + }, + { + ResourceName: "google_datastream_private_connection.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"private_connection_id", "location"}, + }, + }, + }) +} + +func testAccDatastreamPrivateConnection_datastreamPrivateConnectionFullExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_datastream_private_connection" "default" { + display_name = "Connection profile" + location = "us-central1" + private_connection_id = "tf-test-my-connection%{random_suffix}" + + labels = { + key = "value" + } + + vpc_peering_config { + vpc = google_compute_network.default.id + subnet = "10.0.0.0/29" + } +} + +resource "google_compute_network" "default" { + name = "tf-test-my-network%{random_suffix}" +} +`, context) +} + +func testAccCheckDatastreamPrivateConnectionDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_datastream_private_connection" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := googleProviderConfig(t) + + url, err := replaceVarsForTest(config, rs, "{{DatastreamBasePath}}projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = sendRequest(config, "GET", billingProject, url, config.userAgent, nil) + if err == nil { + return fmt.Errorf("DatastreamPrivateConnection still exists at %s", url) + } + } + + return nil + } +} diff --git a/google-beta/resource_datastream_private_connection_sweeper_test.go b/google-beta/resource_datastream_private_connection_sweeper_test.go new file mode 100644 index 0000000000..c9058b765f --- /dev/null +++ b/google-beta/resource_datastream_private_connection_sweeper_test.go @@ -0,0 +1,128 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "context" + "log" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func init() { + resource.AddTestSweepers("DatastreamPrivateConnection", &resource.Sweeper{ + Name: "DatastreamPrivateConnection", + F: testSweepDatastreamPrivateConnection, + }) +} + +// At the time of writing, the CI only passes us-central1 as the region +func testSweepDatastreamPrivateConnection(region string) error { + resourceName := "DatastreamPrivateConnection" + log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) + + config, err := sharedConfigForRegion(region) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) + return err + } + + err = config.LoadAndValidate(context.Background()) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error loading: %s", err) + return err + } + + t := &testing.T{} + billingId := getTestBillingAccountFromEnv(t) + + // Setup variables to replace in list template + d := &ResourceDataMock{ + FieldsInSchema: map[string]interface{}{ + "project": config.Project, + "region": region, + "location": region, + "zone": "-", + "billing_account": billingId, + }, + } + + listTemplate := strings.Split("https://datastream.googleapis.com/v1/projects/{{project}}/locations/{{location}}/privateConnections", "?")[0] + listUrl, err := replaceVars(d, config, listTemplate) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err) + return nil + } + + res, err := sendRequest(config, "GET", config.Project, listUrl, config.userAgent, nil) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err) + return nil + } + + resourceList, ok := res["privateConnections"] + if !ok { + log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") + return nil + } + + rl := resourceList.([]interface{}) + + log.Printf("[INFO][SWEEPER_LOG] Found %d items in %s list response.", len(rl), resourceName) + // Keep count of items that aren't sweepable for logging. + nonPrefixCount := 0 + for _, ri := range rl { + obj := ri.(map[string]interface{}) + var name string + // Id detected in the delete URL, attempt to use id. + if obj["id"] != nil { + name = GetResourceNameFromSelfLink(obj["id"].(string)) + } else if obj["name"] != nil { + name = GetResourceNameFromSelfLink(obj["name"].(string)) + } else { + log.Printf("[INFO][SWEEPER_LOG] %s resource name and id were nil", resourceName) + return nil + } + // Skip resources that shouldn't be sweeped + if !isSweepableTestResource(name) { + nonPrefixCount++ + continue + } + + deleteTemplate := "https://datastream.googleapis.com/v1/projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}" + deleteUrl, err := replaceVars(d, config, deleteTemplate) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err) + return nil + } + deleteUrl = deleteUrl + name + + // Don't wait on operations as we may have a lot to delete + _, err = sendRequest(config, "DELETE", config.Project, deleteUrl, config.userAgent, nil) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] Error deleting for url %s : %s", deleteUrl, err) + } else { + log.Printf("[INFO][SWEEPER_LOG] Sent delete request for %s resource: %s", resourceName, name) + } + } + + if nonPrefixCount > 0 { + log.Printf("[INFO][SWEEPER_LOG] %d items were non-sweepable and skipped.", nonPrefixCount) + } + + return nil +} diff --git a/website/docs/r/datastream_private_connection.html.markdown b/website/docs/r/datastream_private_connection.html.markdown new file mode 100644 index 0000000000..b48492abbb --- /dev/null +++ b/website/docs/r/datastream_private_connection.html.markdown @@ -0,0 +1,138 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in +# .github/CONTRIBUTING.md. +# +# ---------------------------------------------------------------------------- +subcategory: "Datastream" +page_title: "Google: google_datastream_private_connection" +description: |- + The PrivateConnection resource is used to establish private connectivity between Datastream and a customer's network. +--- + +# google\_datastream\_private\_connection + +The PrivateConnection resource is used to establish private connectivity between Datastream and a customer's network. + + +To get more information about PrivateConnection, see: + +* [API documentation](https://cloud.google.com/datastream/docs/reference/rest/v1/projects.locations.privateConnections) +* How-to Guides + * [Official Documentation](https://cloud.google.com/datastream/docs/create-a-private-connectivity-configuration) + + +## Example Usage - Datastream Private Connection Full + + +```hcl +resource "google_datastream_private_connection" "default" { + display_name = "Connection profile" + location = "us-central1" + private_connection_id = "my-connection" + + labels = { + key = "value" + } + + vpc_peering_config { + vpc = google_compute_network.default.id + subnet = "10.0.0.0/29" + } +} + +resource "google_compute_network" "default" { + name = "my-network" +} +``` + +## Argument Reference + +The following arguments are supported: + + +* `display_name` - + (Required) + Display name. + +* `vpc_peering_config` - + (Required) + The VPC Peering configuration is used to create VPC peering + between Datastream and the consumer's VPC. + Structure is [documented below](#nested_vpc_peering_config). + +* `private_connection_id` - + (Required) + The private connectivity identifier. + +* `location` - + (Required) + The name of the location this repository is located in. + + +The `vpc_peering_config` block supports: + +* `vpc` - + (Required) + Fully qualified name of the VPC that Datastream will peer to. + Format: projects/{project}/global/{networks}/{name} + +* `subnet` - + (Required) + A free subnet for peering. (CIDR of /29) + +- - - + + +* `labels` - + (Optional) + Labels. + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the provider project is used. + + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}` + +* `name` - + The resource's name. + + +## Timeouts + +This resource provides the following +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: + +- `create` - Default is 20 minutes. +- `delete` - Default is 20 minutes. + +## Import + + +PrivateConnection can be imported using any of these accepted formats: + +``` +$ terraform import google_datastream_private_connection.default projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}} +$ terraform import google_datastream_private_connection.default {{project}}/{{location}}/{{private_connection_id}} +$ terraform import google_datastream_private_connection.default {{location}}/{{private_connection_id}} +``` + +## User Project Overrides + +This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).