Skip to content
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
13 changes: 13 additions & 0 deletions colab_runtime_template_full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,17 @@ resource "google_colab_runtime_template" "runtime-template" {
encryption_spec {
kms_key_name = "my-crypto-key-${local.name_suffix}"
}

software_config {
env {
name = "TEST"
value = 1
}

post_startup_script_config {
post_startup_script = "echo 'hello world'"
post_startup_script_url = "gs://colab-enterprise-pss-secure/secure_pss.sh"
post_startup_script_behavior = "RUN_ONCE"
}
}
}
15 changes: 15 additions & 0 deletions compute_interconnect_attachment_custom_ranges/backing_file.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file has some scaffolding to make sure that names are unique and that
# a region and zone are selected when you try to create your Terraform resources.

locals {
name_suffix = "${random_pet.suffix.id}"
}

resource "random_pet" "suffix" {
length = 2
}

provider "google" {
region = "us-central1"
zone = "us-central1-c"
}
26 changes: 26 additions & 0 deletions compute_interconnect_attachment_custom_ranges/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "google_compute_interconnect_attachment" "custom-ranges-interconnect-attachment" {
name = "test-custom-ranges-interconnect-attachment-${local.name_suffix}"
edge_availability_domain = "AVAILABILITY_DOMAIN_1"
type = "PARTNER"
router = google_compute_router.foobar.id
mtu = 1500
stack_type = "IPV4_IPV6"
labels = { mykey = "myvalue" }
candidate_cloud_router_ip_address = "192.169.0.1/29"
candidate_customer_router_ip_address = "192.169.0.2/29"
candidate_cloud_router_ipv6_address = "748d:2f23:6651:9455:828b:ca81:6fe0:fed1/125"
candidate_customer_router_ipv6_address = "748d:2f23:6651:9455:828b:ca81:6fe0:fed2/125"
}

resource "google_compute_router" "foobar" {
name = "test-router-${local.name_suffix}"
network = google_compute_network.foobar.name
bgp {
asn = 16550
}
}

resource "google_compute_network" "foobar" {
name = "test-network-${local.name_suffix}"
auto_create_subnetworks = false
}
7 changes: 7 additions & 0 deletions compute_interconnect_attachment_custom_ranges/motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
===

These examples use real resources that will be billed to the
Google Cloud Platform project you use - so make sure that you
run "terraform destroy" before quitting!

===
79 changes: 79 additions & 0 deletions compute_interconnect_attachment_custom_ranges/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Compute Interconnect Attachment Custom Ranges - Terraform

## Setup

<walkthrough-author name="[email protected]" analyticsId="UA-125550242-1" tutorialName="compute_interconnect_attachment_custom_ranges" repositoryUrl="https://github.com/terraform-google-modules/docs-examples"></walkthrough-author>

Welcome to Terraform in Google Cloud Shell! We need you to let us know what project you'd like to use with Terraform.

<walkthrough-project-billing-setup></walkthrough-project-billing-setup>

Terraform provisions real GCP resources, so anything you create in this session will be billed against this project.

## Terraforming!

Let's use {{project-id}} with Terraform! Click the Cloud Shell icon below to copy the command
to your shell, and then run it from the shell by pressing Enter/Return. Terraform will pick up
the project name from the environment variable.

```bash
export GOOGLE_CLOUD_PROJECT={{project-id}}
```

After that, let's get Terraform started. Run the following to pull in the providers.

```bash
terraform init
```

With the providers downloaded and a project set, you're ready to use Terraform. Go ahead!

```bash
terraform apply
```

Terraform will show you what it plans to do, and prompt you to accept. Type "yes" to accept the plan.

```bash
yes
```


## Post-Apply

### Editing your config

Now you've provisioned your resources in GCP! If you run a "plan", you should see no changes needed.

```bash
terraform plan
```

So let's make a change! Try editing a number, or appending a value to the name in the editor. Then,
run a 'plan' again.

```bash
terraform plan
```

Afterwards you can run an apply, which implicitly does a plan and shows you the intended changes
at the 'yes' prompt.

```bash
terraform apply
```

```bash
yes
```

## Cleanup

Run the following to remove the resources Terraform provisioned:

```bash
terraform destroy
```
```bash
yes
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file has some scaffolding to make sure that names are unique and that
# a region and zone are selected when you try to create your Terraform resources.

locals {
name_suffix = "${random_pet.suffix.id}"
}

resource "random_pet" "suffix" {
length = 2
}

provider "google" {
region = "us-central1"
zone = "us-central1-c"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
data "google_datastream_static_ips" "datastream_ips" {
location = "us-central1"
}

resource "google_sql_database_instance" "instance" {
name = "my-instance-${local.name_suffix}"
database_version = "POSTGRES_15"
region = "us-central1"
settings {
tier = "db-f1-micro"
ip_configuration {
ipv4_enabled = true
ssl_mode = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"
dynamic "authorized_networks" {
for_each = data.google_datastream_static_ips.datastream_ips.static_ips
iterator = ip

content {
name = format("datastream-%d", ip.key)
value = ip.value
}
}
}
}

deletion_protection = false
}

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_sql_ssl_cert" "client_cert" {
common_name = "client-name"
instance = google_sql_database_instance.instance.name
}

resource "google_datastream_connection_profile" "default" {
display_name = "Connection Profile"
location = "us-central1"
connection_profile_id = "profile-id-${local.name_suffix}"

postgresql_profile {
hostname = google_sql_database_instance.instance.public_ip_address
port = 5432
username = "user"
password = random_password.pwd.result
database = google_sql_database.db.name
ssl_config {
server_and_client_verification {
client_certificate = google_sql_ssl_cert.client_cert.cert
client_key = google_sql_ssl_cert.client_cert.private_key
ca_certificate = google_sql_ssl_cert.client_cert.server_ca_cert
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
===

These examples use real resources that will be billed to the
Google Cloud Platform project you use - so make sure that you
run "terraform destroy" before quitting!

===
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Datastream Stream Postgresql Sslconfig Server And Client Verification - Terraform

## Setup

<walkthrough-author name="[email protected]" analyticsId="UA-125550242-1" tutorialName="datastream_stream_postgresql_sslconfig_server_and_client_verification" repositoryUrl="https://github.com/terraform-google-modules/docs-examples"></walkthrough-author>

Welcome to Terraform in Google Cloud Shell! We need you to let us know what project you'd like to use with Terraform.

<walkthrough-project-billing-setup></walkthrough-project-billing-setup>

Terraform provisions real GCP resources, so anything you create in this session will be billed against this project.

## Terraforming!

Let's use {{project-id}} with Terraform! Click the Cloud Shell icon below to copy the command
to your shell, and then run it from the shell by pressing Enter/Return. Terraform will pick up
the project name from the environment variable.

```bash
export GOOGLE_CLOUD_PROJECT={{project-id}}
```

After that, let's get Terraform started. Run the following to pull in the providers.

```bash
terraform init
```

With the providers downloaded and a project set, you're ready to use Terraform. Go ahead!

```bash
terraform apply
```

Terraform will show you what it plans to do, and prompt you to accept. Type "yes" to accept the plan.

```bash
yes
```


## Post-Apply

### Editing your config

Now you've provisioned your resources in GCP! If you run a "plan", you should see no changes needed.

```bash
terraform plan
```

So let's make a change! Try editing a number, or appending a value to the name in the editor. Then,
run a 'plan' again.

```bash
terraform plan
```

Afterwards you can run an apply, which implicitly does a plan and shows you the intended changes
at the 'yes' prompt.

```bash
terraform apply
```

```bash
yes
```

## Cleanup

Run the following to remove the resources Terraform provisioned:

```bash
terraform destroy
```
```bash
yes
```
2 changes: 1 addition & 1 deletion dialogflow_conversation_profile_basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "google_dialogflow_agent" "basic_agent" {
display_name = "example_agent"
default_language_code = "en-us"
default_language_code = "en"
time_zone = "America/New_York"
}
resource "google_dialogflow_conversation_profile" "basic_profile" {
Expand Down
20 changes: 18 additions & 2 deletions looker_instance_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@ resource "google_looker_instance" "looker-instance" {
}
psc_config {
allowed_vpcs = ["projects/test-project/global/networks/test"]
# update only
# service_attachments = [{local_fqdn: "www.local-fqdn.com" target_service_attachment_uri: "projects/my-project/regions/us-east1/serviceAttachments/sa"}]

# First Service Attachment
# service_attachments {
# local_fqdn = "www.example-one.com"
# target_service_attachment_uri = "projects/my-project/regions/us-east1/serviceAttachments/sa-1"
# }

# Second Service Attachment
# service_attachments {
# local_fqdn = "api.internal-partner.com"
# target_service_attachment_uri = "projects/partner-project/regions/us-central1/serviceAttachments/sa-gateway"
# }

# Third Service Attachment
# service_attachments {
# local_fqdn = "git.internal-repo.com"
# target_service_attachment_uri = "projects/devops-project/regions/us-west1/serviceAttachments/gitlab-sa"
# }
}
}
15 changes: 15 additions & 0 deletions network_connectivity_destination_basic/backing_file.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file has some scaffolding to make sure that names are unique and that
# a region and zone are selected when you try to create your Terraform resources.

locals {
name_suffix = "${random_pet.suffix.id}"
}

resource "random_pet" "suffix" {
length = 2
}

provider "google" {
region = "us-central1"
zone = "us-central1-c"
}
20 changes: 20 additions & 0 deletions network_connectivity_destination_basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_network_connectivity_multicloud_data_transfer_config" "config" {
name = "basic-config-${local.name_suffix}"
location = "europe-west4"
description = "A basic multicloud data transfer config for the destination example"
}

resource "google_network_connectivity_destination" "example" {
name = "basic-destination-${local.name_suffix}"
location = "europe-west4"
multicloud_data_transfer_config = google_network_connectivity_multicloud_data_transfer_config.config.name
description = "A basic destination"
labels = {
foo = "bar"
}
ip_prefix = "10.0.0.0/8"
endpoints {
asn = "14618"
csp = "AWS"
}
}
Loading