Skip to content

Commit

Permalink
changes to templates/terraform/examples from upgrade012
Browse files Browse the repository at this point in the history
  • Loading branch information
megan07 committed Nov 4, 2019
1 parent 412c7b1 commit b1e73d9
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
resource "google_binary_authorization_attestor" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["attestor_name"] %>"
attestation_authority_note {
note_reference = "${google_container_analysis_note.note.name}"
note_reference = google_container_analysis_note.note.name
public_keys {
id = "${data.google_kms_crypto_key_version.version.id}"
id = data.google_kms_crypto_key_version.version.id
pkix_public_key {
public_key_pem = "${data.google_kms_crypto_key_version.version.public_key[0].pem}"
signature_algorithm = "${data.google_kms_crypto_key_version.version.public_key[0].algorithm}"
public_key_pem = data.google_kms_crypto_key_version.version.public_key[0].pem
signature_algorithm = data.google_kms_crypto_key_version.version.public_key[0].algorithm
}
}
}
}

data "google_kms_crypto_key_version" "version" {
crypto_key = "${google_kms_crypto_key.crypto-key.self_link}"
crypto_key = google_kms_crypto_key.crypto-key.self_link
}

resource "google_container_analysis_note" "note" {
Expand All @@ -27,7 +27,7 @@ resource "google_container_analysis_note" "note" {

resource "google_kms_crypto_key" "crypto-key" {
name = "<%= ctx[:vars]["key_name"] %>"
key_ring = "${google_kms_key_ring.keyring.self_link}"
key_ring = google_kms_key_ring.keyring.self_link
purpose = "ASYMMETRIC_SIGN"

version_template {
Expand Down
20 changes: 11 additions & 9 deletions templates/terraform/examples/logging_metric_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["logging_metric_name"] %>"
name = "<%= ctx[:vars]["logging_metric_name"] %>"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor {
metric_kind = "DELTA"
value_type = "DISTRIBUTION"
unit = "1"
value_type = "DISTRIBUTION"
unit = "1"
labels {
key = "mass"
value_type = "STRING"
description = "amount of matter"
key = "mass"
value_type = "STRING"
description = "amount of matter"
}
}
value_extractor = "EXTRACT(jsonPayload.request)"
label_extractors = { "mass": "EXTRACT(jsonPayload.request)" }
label_extractors = {
"mass" = "EXTRACT(jsonPayload.request)"
}
bucket_options {
linear_buckets {
num_finite_buckets = 3
width = 1
offset = 1
width = 1
offset = 1
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["logging_metric_name"] %>"
name = "<%= ctx[:vars]["logging_metric_name"] %>"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor {
metric_kind = "DELTA"
value_type = "INT64"
value_type = "INT64"
labels {
key = "mass"
value_type = "STRING"
description = "amount of matter"
key = "mass"
value_type = "STRING"
description = "amount of matter"
}
}
label_extractors = { "mass": "EXTRACT(jsonPayload.request)" }
label_extractors = {
"mass" = "EXTRACT(jsonPayload.request)"
}
}
20 changes: 11 additions & 9 deletions templates/terraform/examples/tpu_node_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<%#-
WARNING: cidr_block must not overlap with other existing TPU blocks
Make sure if you change this value that it does not overlap with the
autogenerated examples.
WARNING: cidr_block must not overlap with other existing TPU blocks
Make sure if you change this value that it does not overlap with the
autogenerated examples.
-%>
data "google_tpu_tensorflow_versions" "available" { }

data "google_tpu_tensorflow_versions" "available" {
}

resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["node_name"] %>"
zone = "us-central1-b"
name = "<%= ctx[:vars]["node_name"] %>"
zone = "us-central1-b"

accelerator_type = "v3-8"
tensorflow_version = "${data.google_tpu_tensorflow_versions.available.versions[0]}"
cidr_block = "10.2.0.0/29"
accelerator_type = "v3-8"
tensorflow_version = data.google_tpu_tensorflow_versions.available.versions[0]
cidr_block = "10.2.0.0/29"
}
44 changes: 23 additions & 21 deletions templates/terraform/examples/tpu_node_full.tf.erb
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
data "google_tpu_tensorflow_versions" "available" { }
data "google_tpu_tensorflow_versions" "available" {
}

<%#-
WARNING: cidr_block must not overlap with other existing TPU blocks
Make sure if you change this value that it does not overlap with the
autogenerated examples.
WARNING: cidr_block must not overlap with other existing TPU blocks
Make sure if you change this value that it does not overlap with the
autogenerated examples.
-%>

resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["node_name"] %>"
zone = "us-central1-b"
name = "<%= ctx[:vars]["node_name"] %>"
zone = "us-central1-b"

accelerator_type = "v3-8"
accelerator_type = "v3-8"

cidr_block = "10.3.0.0/29"
tensorflow_version = "${data.google_tpu_tensorflow_versions.available.versions[0]}"
cidr_block = "10.3.0.0/29"
tensorflow_version = data.google_tpu_tensorflow_versions.available.versions[0]

description = "Terraform Google Provider test TPU"
description = "Terraform Google Provider test TPU"
<%#-
We previously used a separate network resource here, but TPUs only allow using 50
different network names, ever. This caused our tests to start failing, so just
use the default network in order to still demonstrate using as many fields as
possible on the resource.
We previously used a separate network resource here, but TPUs only allow using 50
different network names, ever. This caused our tests to start failing, so just
use the default network in order to still demonstrate using as many fields as
possible on the resource.
-%>
network = "default"
network = "default"

labels = {
foo = "bar"
}
labels = {
foo = "bar"
}

scheduling_config {
preemptible = true
}
scheduling_config {
preemptible = true
}
}

0 comments on commit b1e73d9

Please sign in to comment.