Skip to content

Commit

Permalink
Merge pull request #11179 from c2thorn/sync-main-FEATURE-BRANCH-6.0.0
Browse files Browse the repository at this point in the history
Sync main feature branch 6.0.0 - 7/16

[upstream:4b86cb21f180699aa01ab9cea21812bd58c46815]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician committed Jul 17, 2024
1 parent 4bbbb48 commit c7d6eae
Show file tree
Hide file tree
Showing 17 changed files with 617 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bigquery_dataset_resource_tags/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"
}
34 changes: 34 additions & 0 deletions bigquery_dataset_resource_tags/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
data "google_project" "project" {
}

resource "google_tags_tag_key" "tag_key1" {
parent = "projects/${data.google_project.project.number}"
short_name = "tag_key1-${local.name_suffix}"
}

resource "google_tags_tag_value" "tag_value1" {
parent = "tagKeys/${google_tags_tag_key.tag_key1.name}"
short_name = "tag_value1-${local.name_suffix}"
}

resource "google_tags_tag_key" "tag_key2" {
parent = "projects/${data.google_project.project.number}"
short_name = "tag_key2-${local.name_suffix}"
}

resource "google_tags_tag_value" "tag_value2" {
parent = "tagKeys/${google_tags_tag_key.tag_key2.name}"
short_name = "tag_value2-${local.name_suffix}"
}

resource "google_bigquery_dataset" "dataset" {
dataset_id = "dataset-${local.name_suffix}"
friendly_name = "test"
description = "This is a test description"
location = "EU"

resource_tags = {
"${data.google_project.project.project_id}/${google_tags_tag_key.tag_key1.short_name}" = "${google_tags_tag_value.tag_value1.short_name}"
"${data.google_project.project.project_id}/${google_tags_tag_key.tag_key2.short_name}" = "${google_tags_tag_value.tag_value2.short_name}"
}
}
7 changes: 7 additions & 0 deletions bigquery_dataset_resource_tags/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 bigquery_dataset_resource_tags/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Bigquery Dataset Resource Tags - Terraform

## Setup

<walkthrough-author name="[email protected]" analyticsId="UA-125550242-1" tutorialName="bigquery_dataset_resource_tags" 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
```
15 changes: 15 additions & 0 deletions compute_mig_resize_request/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"
}
69 changes: 69 additions & 0 deletions compute_mig_resize_request/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
resource "google_compute_region_instance_template" "a3_dws" {
name = "a3-dws"
region = "us-central1"
description = "This template is used to create a mig instance that is compatible with DWS resize requests."
instance_description = "A3 GPU"
machine_type = "a3-highgpu-8g"
can_ip_forward = false

scheduling {
automatic_restart = false
on_host_maintenance = "TERMINATE"
}

disk {
source_image = "cos-cloud/cos-105-lts"
auto_delete = true
boot = true
disk_type = "pd-ssd"
disk_size_gb = "960"
mode = "READ_WRITE"
}

guest_accelerator {
type = "nvidia-h100-80gb"
count = 8
}

reservation_affinity {
type = "NO_RESERVATION"
}

shielded_instance_config {
enable_vtpm = true
enable_integrity_monitoring = true
}

network_interface {
network = "default"
}
}

resource "google_compute_instance_group_manager" "a3_dws" {
name = "a3-dws"
base_instance_name = "a3-dws"
zone = "us-central1-a"

version {
instance_template = google_compute_region_instance_template.a3_dws.self_link
}

instance_lifecycle_policy {
default_action_on_failure = "DO_NOTHING"
}

wait_for_instances = false

}

resource "google_compute_resize_request" "a3_resize_request" {
name = "a3-dws-${local.name_suffix}"
instance_group_manager = google_compute_instance_group_manager.a3_dws.name
zone = "us-central1-a"
description = "Test resize request resource"
resize_by = 2
requested_run_duration {
seconds = 14400
nanos = 0
}
}
7 changes: 7 additions & 0 deletions compute_mig_resize_request/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_mig_resize_request/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Compute Mig Resize Request - Terraform

## Setup

<walkthrough-author name="[email protected]" analyticsId="UA-125550242-1" tutorialName="compute_mig_resize_request" 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
```
1 change: 1 addition & 0 deletions datastream_stream_bigquery/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ resource "google_datastream_stream" "default" {
kms_key_name = "bigquery-kms-name-${local.name_suffix}"
}
}
merge {}
}
}

Expand Down
15 changes: 15 additions & 0 deletions datastream_stream_bigquery_append_only/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"
}
Loading

0 comments on commit c7d6eae

Please sign in to comment.