-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a556ff4
commit 6e3f780
Showing
75 changed files
with
1,440 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "google_compute_address" "ip_address" { | ||
name = "my-address-${local.name_suffix}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "google_compute_network" "default" { | ||
name = "my-network-${local.name_suffix}" | ||
} | ||
|
||
resource "google_compute_subnetwork" "default" { | ||
name = "my-subnet-${local.name_suffix}" | ||
ip_cidr_range = "10.0.0.0/16" | ||
region = "us-central1" | ||
network = "${google_compute_network.default.self_link}" | ||
} | ||
|
||
resource "google_compute_address" "internal_with_subnet_and_address" { | ||
name = "my-internal-address-${local.name_suffix}" | ||
subnetwork = "${google_compute_subnetwork.default.self_link}" | ||
address_type = "INTERNAL" | ||
address = "10.0.42.42" | ||
region = "us-central1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
resource "google_compute_autoscaler" "foobar" { | ||
name = "my-autoscaler-${local.name_suffix}" | ||
zone = "us-central1-f" | ||
target = "${google_compute_instance_group_manager.foobar.self_link}" | ||
|
||
autoscaling_policy { | ||
max_replicas = 5 | ||
min_replicas = 1 | ||
cooldown_period = 60 | ||
|
||
cpu_utilization { | ||
target = 0.5 | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_instance_template" "foobar" { | ||
name = "my-instance-template-${local.name_suffix}" | ||
machine_type = "n1-standard-1" | ||
can_ip_forward = false | ||
|
||
tags = ["foo", "bar"] | ||
|
||
disk { | ||
source_image = "${data.google_compute_image.debian_9.self_link}" | ||
} | ||
|
||
network_interface { | ||
network = "default" | ||
} | ||
|
||
metadata = { | ||
foo = "bar" | ||
} | ||
|
||
service_account { | ||
scopes = ["userinfo-email", "compute-ro", "storage-ro"] | ||
} | ||
} | ||
|
||
resource "google_compute_target_pool" "foobar" { | ||
name = "my-target-pool-${local.name_suffix}" | ||
} | ||
|
||
resource "google_compute_instance_group_manager" "foobar" { | ||
name = "my-igm-${local.name_suffix}" | ||
zone = "us-central1-f" | ||
|
||
instance_template = "${google_compute_instance_template.foobar.self_link}" | ||
|
||
target_pools = ["${google_compute_target_pool.foobar.self_link}"] | ||
base_instance_name = "foobar" | ||
} | ||
|
||
data "google_compute_image" "debian_9" { | ||
family = "debian-9" | ||
project = "debian-cloud" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "google_compute_backend_bucket" "image_backend" { | ||
name = "image-backend-bucket-${local.name_suffix}" | ||
description = "Contains beautiful images" | ||
bucket_name = "${google_storage_bucket.image_bucket.name}" | ||
enable_cdn = true | ||
} | ||
|
||
resource "google_storage_bucket" "image_bucket" { | ||
name = "image-store-bucket-${local.name_suffix}" | ||
location = "EU" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "google_compute_backend_service" "default" { | ||
name = "backend-service-${local.name_suffix}" | ||
health_checks = ["${google_compute_http_health_check.default.self_link}"] | ||
} | ||
|
||
resource "google_compute_http_health_check" "default" { | ||
name = "health-check-${local.name_suffix}" | ||
request_path = "/" | ||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
resource "google_bigquery_dataset" "dataset" { | ||
dataset_id = "example_dataset-${local.name_suffix}" | ||
friendly_name = "test" | ||
description = "This is a test description" | ||
location = "EU" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
|
||
access { | ||
role = "OWNER" | ||
user_by_email = "[email protected]" | ||
} | ||
access { | ||
role = "READER" | ||
domain = "example.com" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
build/kcc/samples/bigtable_app_profile_multicluster/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resource "google_bigtable_instance" "instance" { | ||
name = "tf-test-instance--${local.name_suffix}" | ||
cluster { | ||
cluster_id = "tf-test-instance--${local.name_suffix}" | ||
zone = "us-central1-b" | ||
num_nodes = 3 | ||
storage_type = "HDD" | ||
} | ||
} | ||
|
||
resource "google_bigtable_app_profile" "ap" { | ||
instance = google_bigtable_instance.instance.name | ||
app_profile_id = "tf-test-profile--${local.name_suffix}" | ||
|
||
multi_cluster_routing_use_any = true | ||
ignore_warnings = true | ||
} |
21 changes: 21 additions & 0 deletions
21
build/kcc/samples/bigtable_app_profile_singlecluster/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
resource "google_bigtable_instance" "instance" { | ||
name = "tf-test-instance--${local.name_suffix}" | ||
cluster { | ||
cluster_id = "tf-test-instance--${local.name_suffix}" | ||
zone = "us-central1-b" | ||
num_nodes = 3 | ||
storage_type = "HDD" | ||
} | ||
} | ||
|
||
resource "google_bigtable_app_profile" "ap" { | ||
instance = google_bigtable_instance.instance.name | ||
app_profile_id = "tf-test-profile--${local.name_suffix}" | ||
|
||
single_cluster_routing { | ||
cluster_id = "tf-test-instance--${local.name_suffix}" | ||
allow_transactional_writes = true | ||
} | ||
|
||
ignore_warnings = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
resource "google_cloudbuild_trigger" "filename-trigger" { | ||
trigger_template { | ||
branch_name = "master" | ||
repo_name = "my-repo" | ||
} | ||
|
||
substitutions = { | ||
_FOO = "bar" | ||
_BAZ = "qux" | ||
} | ||
|
||
filename = "cloudbuild.yaml" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resource "google_compute_disk" "default" { | ||
name = "test-disk-${local.name_suffix}" | ||
type = "pd-ssd" | ||
zone = "us-central1-a" | ||
image = "debian-8-jessie-v20170523" | ||
labels = { | ||
environment = "dev" | ||
} | ||
physical_block_size_bytes = 4096 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "google_dns_managed_zone" "example-zone" { | ||
name = "example-zone" | ||
dns_name = "example-${random_id.rnd.hex}.com." | ||
description = "Example DNS zone" | ||
labels = { | ||
foo = "bar" | ||
} | ||
} | ||
|
||
resource "random_id" "rnd" { | ||
byte_length = 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
resource "google_dns_managed_zone" "private-zone" { | ||
name = "private-zone-${local.name_suffix}" | ||
dns_name = "private.example.com." | ||
description = "Example private DNS zone" | ||
labels = { | ||
foo = "bar" | ||
} | ||
|
||
visibility = "private" | ||
|
||
private_visibility_config { | ||
networks { | ||
network_url = "${google_compute_network.network-1.self_link}" | ||
} | ||
networks { | ||
network_url = "${google_compute_network.network-2.self_link}" | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_network" "network-1" { | ||
name = "network-1-${local.name_suffix}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_network" "network-2" { | ||
name = "network-2-${local.name_suffix}" | ||
auto_create_subnetworks = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
resource "google_filestore_instance" "instance" { | ||
name = "test-instance-${local.name_suffix}" | ||
zone = "us-central1-b" | ||
tier = "PREMIUM" | ||
|
||
file_shares { | ||
capacity_gb = 2660 | ||
name = "share1" | ||
} | ||
|
||
networks { | ||
network = "default" | ||
modes = ["MODE_IPV4"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
resource "google_compute_firewall" "default" { | ||
name = "test-firewall-${local.name_suffix}" | ||
network = "${google_compute_network.default.name}" | ||
|
||
allow { | ||
protocol = "icmp" | ||
} | ||
|
||
allow { | ||
protocol = "tcp" | ||
ports = ["80", "8080", "1000-2000"] | ||
} | ||
|
||
source_tags = ["web"] | ||
} | ||
|
||
resource "google_compute_network" "default" { | ||
name = "test-network-${local.name_suffix}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resource "google_compute_forwarding_rule" "default" { | ||
name = "website-forwarding-rule-${local.name_suffix}" | ||
target = "${google_compute_target_pool.default.self_link}" | ||
port_range = "80" | ||
} | ||
|
||
resource "google_compute_target_pool" "default" { | ||
name = "website-target-pool-${local.name_suffix}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Forwarding rule for Internal Load Balancing | ||
resource "google_compute_forwarding_rule" "default" { | ||
name = "website-forwarding-rule-${local.name_suffix}" | ||
region = "us-central1" | ||
|
||
load_balancing_scheme = "INTERNAL" | ||
backend_service = "${google_compute_region_backend_service.backend.self_link}" | ||
all_ports = true | ||
network = "${google_compute_network.default.name}" | ||
subnetwork = "${google_compute_subnetwork.default.name}" | ||
} | ||
|
||
resource "google_compute_region_backend_service" "backend" { | ||
name = "website-backend-${local.name_suffix}" | ||
region = "us-central1" | ||
health_checks = ["${google_compute_health_check.hc.self_link}"] | ||
} | ||
|
||
resource "google_compute_health_check" "hc" { | ||
name = "check-website-backend-${local.name_suffix}" | ||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
|
||
tcp_health_check { | ||
port = "80" | ||
} | ||
} | ||
|
||
resource "google_compute_network" "default" { | ||
name = "website-net-${local.name_suffix}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "default" { | ||
name = "website-net-${local.name_suffix}" | ||
ip_cidr_range = "10.0.0.0/16" | ||
region = "us-central1" | ||
network = "${google_compute_network.default.self_link}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "google_compute_global_address" "default" { | ||
name = "global-appserver-ip-${local.name_suffix}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
resource "google_compute_global_forwarding_rule" "default" { | ||
name = "global-rule-${local.name_suffix}" | ||
target = "${google_compute_target_http_proxy.default.self_link}" | ||
port_range = "80" | ||
} | ||
|
||
resource "google_compute_target_http_proxy" "default" { | ||
name = "target-proxy-${local.name_suffix}" | ||
description = "a description" | ||
url_map = "${google_compute_url_map.default.self_link}" | ||
} | ||
|
||
resource "google_compute_url_map" "default" { | ||
name = "url-map-target-proxy-${local.name_suffix}" | ||
description = "a description" | ||
default_service = "${google_compute_backend_service.default.self_link}" | ||
|
||
host_rule { | ||
hosts = ["mysite.com"] | ||
path_matcher = "allpaths" | ||
} | ||
|
||
path_matcher { | ||
name = "allpaths" | ||
default_service = "${google_compute_backend_service.default.self_link}" | ||
|
||
path_rule { | ||
paths = ["/*"] | ||
service = "${google_compute_backend_service.default.self_link}" | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_backend_service" "default" { | ||
name = "backend-${local.name_suffix}" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
|
||
health_checks = ["${google_compute_http_health_check.default.self_link}"] | ||
} | ||
|
||
resource "google_compute_http_health_check" "default" { | ||
name = "check-backend-${local.name_suffix}" | ||
request_path = "/" | ||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resource "google_compute_health_check" "internal-health-check" { | ||
name = "internal-service-health-check-${local.name_suffix}" | ||
|
||
timeout_sec = 1 | ||
check_interval_sec = 1 | ||
|
||
tcp_health_check { | ||
port = "80" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "google_compute_http_health_check" "default" { | ||
name = "authentication-health-check-${local.name_suffix}" | ||
request_path = "/health_check" | ||
|
||
timeout_sec = 1 | ||
check_interval_sec = 1 | ||
} |
Oops, something went wrong.