google_datastream_connection_profile

A set of reusable connection configurations to be used as a source or destination for a stream.

To get more information about ConnectionProfile, see:

Open in Cloud Shell

Example Usage - Datastream Connection Profile Basic

resource "google_datastream_connection_profile" "default" {
    display_name          = "Connection profile"
    location              = "us-central1"
    connection_profile_id = "my-profile"

    gcs_profile {
        bucket    = "my-bucket"
        root_path = "/path"
    }
}
Open in Cloud Shell

Example Usage - Datastream Connection Profile Postgresql Private Connection

resource "google_datastream_private_connection" "private_connection" {
    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"
}

resource "google_sql_database_instance" "instance" {
    name             = "my-instance"
    database_version = "POSTGRES_14"
    region           = "us-central1"
    settings {
        tier = "db-f1-micro"

        ip_configuration {

            // Datastream IPs will vary by region.
            authorized_networks {
                value = "34.71.242.81"
            }

            authorized_networks {
                value = "34.72.28.29"
            }

            authorized_networks {
                value = "34.67.6.157"
            }

            authorized_networks {
                value = "34.67.234.134"
            }

            authorized_networks {
                value = "34.72.239.218"
            }
        }
    }

    deletion_protection  = "true"
}

resource "google_sql_database" "db" {
    instance = google_sql_database_instance.instance.name
    name     = "db"
}

resource "random_password" "pwd" {
    length = 16
    special = false
}

resource "google_sql_user" "user" {
    name = "user"
    instance = google_sql_database_instance.instance.name
    password = random_password.pwd.result
}

resource "google_datastream_connection_profile" "default" {
    display_name          = "Connection profile"
    location              = "us-central1"
    connection_profile_id = "my-profile"

    postgresql_profile {
        hostname = google_sql_database_instance.instance.public_ip_address
      username = google_sql_user.user.name
      password = google_sql_user.user.password
      database = google_sql_database.db.name
    }

    private_connectivity {
        private_connection = google_datastream_private_connection.private_connection.id
    }
}
Open in Cloud Shell

Example Usage - Datastream Connection Profile Full

resource "google_datastream_connection_profile" "default" {
    display_name          = "Connection profile"
    location              = "us-central1"
    connection_profile_id = "my-profile"

    gcs_profile {
        bucket    = "my-bucket"
        root_path = "/path"
    }

    forward_ssh_connectivity {
        hostname = "google.com"
        username = "my-user"
        port     = 8022
        password = "swordfish"
    }
    labels = {
        key = "value"
    }
}

Example Usage - Datastream Connection Profile Postgres

resource "google_sql_database_instance" "instance" {
    name             = "my-instance"
    database_version = "POSTGRES_14"
    region           = "us-central1"
    settings {
        tier = "db-f1-micro"

        ip_configuration {

            // Datastream IPs will vary by region.
            authorized_networks {
                value = "34.71.242.81"
            }

            authorized_networks {
                value = "34.72.28.29"
            }

            authorized_networks {
                value = "34.67.6.157"
            }

            authorized_networks {
                value = "34.67.234.134"
            }

            authorized_networks {
                value = "34.72.239.218"
            }
        }
    }

    deletion_protection  = "true"
}

resource "google_sql_database" "db" {
    instance = google_sql_database_instance.instance.name
    name     = "db"
}

resource "random_password" "pwd" {
    length = 16
    special = false
}

resource "google_sql_user" "user" {
    name = "user"
    instance = google_sql_database_instance.instance.name
    password = random_password.pwd.result
}

resource "google_datastream_connection_profile" "default" {
    display_name          = "Connection profile"
    location              = "us-central1"
    connection_profile_id = "my-profile"

    postgresql_profile {
        hostname = google_sql_database_instance.instance.public_ip_address
        username = google_sql_user.user.name
        password = google_sql_user.user.password
        database = google_sql_database.db.name
    }
}

Argument Reference

The following arguments are supported:


The oracle_profile block supports:

The gcs_profile block supports:

The mysql_profile block supports:

The ssl_config block supports:

The postgresql_profile block supports:

The forward_ssh_connectivity block supports:

The private_connectivity block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

ConnectionProfile can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import ConnectionProfile using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}"
  to = google_datastream_connection_profile.default
}

When using the terraform import command, ConnectionProfile can be imported using one of the formats above. For example:

$ terraform import google_datastream_connection_profile.default projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}
$ terraform import google_datastream_connection_profile.default {{project}}/{{location}}/{{connection_profile_id}}
$ terraform import google_datastream_connection_profile.default {{location}}/{{connection_profile_id}}

User Project Overrides

This resource supports User Project Overrides.