Skip to content

Commit

Permalink
Update two-layer-architecture/
Browse files Browse the repository at this point in the history
  • Loading branch information
toshi0607 committed Aug 28, 2022
1 parent e5b0323 commit 51eaf67
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 14 deletions.
28 changes: 28 additions & 0 deletions two-layer-architecture/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion two-layer-architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ This example doesn't specify a credential and a project intentionally.
```shell
$ gcloud auth application-default login

# replace 【YOUR PROJECT】 with your project
# e.g.
# export GOOGLE_PROJECT=terraform-toshi0607
# 【YOUR PROJECT】をあなたのGCPプロジェクトに置き換えてください。
$ export GOOGLE_PROJECT=【YOUR PROJECT】

$ terraform init
Expand Down
13 changes: 4 additions & 9 deletions two-layer-architecture/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12"
required_version = ">= 1.2"
}

# https://www.terraform.io/docs/providers/google/index.html
Expand All @@ -19,16 +19,12 @@ resource "google_compute_instance_template" "default" {
tags = ["allow-ssh", "allow-service"]

disk {
source_image = "debian-cloud/debian-9"
source_image = "debian-cloud/debian-11"
}

service_account {
scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring.write",
"https://www.googleapis.com/auth/devstorage.full_control",
]
# https://cloud.google.com/compute/docs/access/service-accounts#authorization
scopes = ["cloud-platform"]
}

network_interface {
Expand Down Expand Up @@ -156,7 +152,6 @@ resource "tls_private_key" "example" {

# https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert
resource "tls_self_signed_cert" "example" {
key_algorithm = tls_private_key.example.algorithm
private_key_pem = tls_private_key.example.private_key_pem

# Certificate expires after 12 hours.
Expand Down
9 changes: 5 additions & 4 deletions two-layer-architecture/terraform.tfvars.sapmple
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 利用する場合は拡張子の .sample 部分を削除してください
# remove .sample when you try tfvars

# replace 【YOUR PROJECT】 with your project
# e.g.
# project = "terraform-toshi0607"
# 【YOUR PROJECT】をあなたのGCPプロジェクトに置き換えてください。
project = 【YOUR PROJECT】
gcp_project = 【YOUR PROJECT】
gcp_region = "asia-northeast1"
gcp_zone = "asia-northeast1-a"
gcp_zone = "asia-northeast1-c"

0 comments on commit 51eaf67

Please sign in to comment.