Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert example templates (part 3) #10391

Merged
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
26 changes: 26 additions & 0 deletions mmv1/templates/terraform/examples/go/edgecontainer_cluster.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "edgecontainer_cluster_name"}}"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}

labels = {
my_key = "my_val"
other_key = "other_val"
}
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "edgecontainer_cluster_name"}}"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}

maintenance_policy {
window {
recurring_window {
window {
start_time = "2023-01-01T08:00:00Z"
end_time = "2023-01-01T17:00:00Z"
}

recurrence = "FREQ=WEEKLY;BYDAY=SA"
}
}
}
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "edgecontainer_cluster_name"}}"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}

external_load_balancer_ipv4_address_pools = ["10.100.0.0-10.100.0.10"]

control_plane {
local {
node_location = "us-central1-edge-example-edgesite"
node_count = 1
machine_filter = "machine-name"
shared_deployment_policy = "ALLOWED"
}
}
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "edgecontainer_cluster_name"}}"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}

external_load_balancer_ipv4_address_pools = ["10.100.0.0-10.100.0.10"]

control_plane {
local {
node_location = "us-central1-edge-example-edgesite"
node_count = 1
machine_filter = "machine-name"
shared_deployment_policy = "ALLOWED"
}
}
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "edgecontainer_cluster_name"}}"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}

external_load_balancer_ipv4_address_pools = ["10.100.0.0-10.100.0.10"]

control_plane {
local {
node_location = "us-central1-edge-example-edgesite"
node_count = 1
machine_filter = "machine-name"
shared_deployment_policy = "ALLOWED"
}
}
}

resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" {
name = "nodepool-1"
cluster = google_edgecontainer_cluster.cluster.name
location = "us-central1"
node_location = "us-central1-edge-example-edgesite"
node_count = 3
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
resource "google_edgecontainer_cluster" "cluster" {
name = "tf-lcp-cluster"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.16.0.0/16"]
services_ipv4_cidr_blocks = ["10.17.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}

external_load_balancer_ipv4_address_pools = ["172.17.34.97-172.17.34.99"]

control_plane {
local {
node_location = "us-central1-edge-den25349"
node_count = 1
shared_deployment_policy = "ALLOWED"
}
}
}

resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" {
name = "nodepool-1"
cluster = google_edgecontainer_cluster.cluster.name
location = "us-central1"
node_location = "us-central1-edge-den25349"
node_count = 1
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
resource "google_edgecontainer_cluster" "cluster" {
name = "default"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}
}

resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" {
name = "nodepool-1"
cluster = google_edgecontainer_cluster.cluster.name
location = "us-central1"
node_location = "us-central1-edge-example-edgesite"
node_count = 3

labels = {
my_key = "my_val"
other_key = "other_val"
}
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
resource "google_edgecontainer_cluster" "cluster" {
name = "default"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}
}

resource "google_kms_crypto_key_iam_member" "crypto_key" {
crypto_key_id = google_kms_crypto_key.crypto_key.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-edgecontainer.iam.gserviceaccount.com"
}

resource "google_kms_crypto_key" "crypto_key" {
name = "key"
key_ring = google_kms_key_ring.key_ring.id
}

resource "google_kms_key_ring" "key_ring" {
name = "keyring"
location = "us-central1"
}

resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" {
depends_on = [google_kms_crypto_key_iam_member.crypto_key]

name = "nodepool-1"
cluster = google_edgecontainer_cluster.cluster.name
location = "us-central1"
node_location = "us-central1-edge-example-edgesite"
node_count = 3

local_disk_encryption {
kms_key = google_kms_crypto_key.crypto_key.id
}
}

data "google_project" "project" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
resource "google_edgecontainer_cluster" "cluster" {
name = "default"
location = "us-central1"

authorization {
admin_users {
username = "[email protected]"
}
}

networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}

fleet {
project = "projects/${data.google_project.project.number}"
}
}

resource "google_edgecontainer_node_pool" "node_pool" {
name = "nodepool-1"
cluster = google_edgecontainer_cluster.cluster.name
location = "us-central1"
node_location = "us-central1-edge-example-edgesite"
node_count = 3
}

resource "google_edgecontainer_vpn_connection" "{{$.PrimaryResourceId}}" {
depends_on = [google_edgecontainer_node_pool.node_pool]
name = "vpn-connection-1"
location = "us-central1"
cluster = "projects/${data.google_project.project.number}/locations/us-east1/clusters/${google_edgecontainer_cluster.cluster.name}"
vpc = google_compute_network.vpc.name
enable_high_availability = true

labels = {
my_key = "my_val"
other_key = "other_val"
}
}

resource "google_compute_network" "vpc" {
name = "example-vpc"
}

data "google_project" "project" {}
12 changes: 12 additions & 0 deletions mmv1/templates/terraform/examples/go/edgenetwork_network.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "google_edgenetwork_network" "{{$.PrimaryResourceId}}" {
network_id = "{{index $.Vars "edgenetwork_network_id"}}"
location = "{{index $.TestEnvVars "location"}}"
zone = "{{index $.TestEnvVars "zone"}}"
description = "Example network."
mtu = 9000
labels = {
"environment" : "dev"
}
}


20 changes: 20 additions & 0 deletions mmv1/templates/terraform/examples/go/edgenetwork_subnet.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

resource "google_edgenetwork_subnet" "{{$.PrimaryResourceId}}" {
subnet_id = "{{index $.Vars "edgenetwork_subnet_id"}}"
location = "{{index $.TestEnvVars "location"}}"
zone = "{{index $.TestEnvVars "zone"}}"
description = "Example subnet."
network = google_edgenetwork_network.example_network.id
ipv4_cidr = ["4.4.4.1/24"]
labels = {
"environment" : "dev"
}
}

resource "google_edgenetwork_network" "example_network" {
network_id = "{{index $.Vars "edgenetwork_network_id"}}"
location = "{{index $.TestEnvVars "location"}}"
zone = "{{index $.TestEnvVars "zone"}}"
description = "Example network."
mtu = 9000
}
Loading
Loading