Skip to content

Commit

Permalink
[gcp,terraform] Add some notes
Browse files Browse the repository at this point in the history
  • Loading branch information
progrhyme committed Mar 17, 2021
1 parent efb7cb9 commit b1b104b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
19 changes: 17 additions & 2 deletions content/ja/a/google/gcp/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ https://cloud.google.com/cloud-build/docs/build-config
- docker build -> Dockerfile
- その他の処理 -> ビルド構成ファイル(YAML or JSON)


### ビルド構成ファイル

https://cloud.google.com/cloud-build/docs/build-config?hl=ja#structure_of_a_build_config_file
Expand All @@ -29,11 +28,27 @@ https://cloud.google.com/cloud-build/docs/build-config?hl=ja#build_steps

## ビルドトリガーによるビルドの自動化

[ビルドトリガーを使用したビルドの自動化 | Cloud Build のドキュメント | Google Cloud](https://cloud.google.com/cloud-build/docs/running-builds/automate-builds?hl=ja)
ドキュメント:

- [ビルドトリガーを使用したビルドの自動化 | Cloud Build のドキュメント | Google Cloud](https://cloud.google.com/cloud-build/docs/running-builds/automate-builds?hl=ja)
- [Creating and managing build triggers | Cloud Build Documentation](https://cloud.google.com/build/docs/automating-builds/create-manage-triggers)

MEMO:

- GCSR, GitHub or Bitbucketにソースコードが必要
- Bitbucketの場合GCSRにミラーリングするか、コンソールからリポジトリ登録時に認証を行う

### トリガー設定

項目 | 必須? | 説明
-----|-------|------
Source | Yes | リポジトリとブランチ/タグを選ぶ
Included files | No | 設定されていると、ビルドをトリガーするには最低でもここに含まれるいずれかのファイルの変更が必要
Ignored files | No | 設定されたファイルリストのみの変更はビルドをトリガーしない

Included files / Ignored filesについて:
- あるファイルを両方に指定したら、そのファイルへの変更はビルドをトリガーしない
- 新規ブランチをpushした場合、全ファイルが変更されたとみなされる

## ビルド通知の送信

Expand Down
11 changes: 11 additions & 0 deletions content/ja/a/google/gcp/gke/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ TL;DR:

[クラスタのセキュリティの強化 | Kubernetes Engine ドキュメント | Google Cloud](https://cloud.google.com/kubernetes-engine/docs/how-to/hardening-your-cluster?hl=ja)

### Secretリソースへのアクセスを制限する

いずれか:

1. IAMで `container.secrets.*` の権限を与えない
- `roles/container.viewer` なら権限なし
1. RBACで権限制御する

参考:
- [【GKE】kubernetesのsecretリソースにアクセスできるユーザーを制限したい](https://zenn.dev/nekoshita/articles/30809412399f70)

### 最小権限のGoogleサービスアカウント

https://cloud.google.com/kubernetes-engine/docs/how-to/hardening-your-cluster?hl=ja#use_least_privilege_sa
Expand Down
9 changes: 7 additions & 2 deletions content/ja/a/software/terraform/provider/google.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ https://www.terraform.io/docs/providers/google/r/google_project_iam.html
- [google_compute_managed_ssl_certificate](https://www.terraform.io/docs/providers/google/r/compute_managed_ssl_certificate.html) ... β (2020-03-18) HTTPS LBのためのマネージドTLS証明書
- [google_compute_security_policy](https://www.terraform.io/docs/providers/google/r/compute_security_policy.html) ... Cloud Armorのセキュリティポリシー

ネットワーク関係:
IAM関係:

- https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_iam
- 基本的には `google_compute_instance_iam_member` で管理すればいいと思う

#### ネットワーク関係

- [google_compute_address](https://www.terraform.io/docs/providers/google/r/compute_address.html) ... `EXTERNAL` なアドレスも発行できる。Cloud NATに使うのはこっち
- [google_compute_global_address](https://www.terraform.io/docs/providers/google/r/compute_global_address.html) ... HTTP(S) LBで使うやつ
Expand All @@ -114,7 +119,7 @@ https://www.terraform.io/docs/providers/google/r/google_project_iam.html
- [google_compute_router](https://www.terraform.io/docs/providers/google/r/compute_router.html) ... Cloud Router
- [google_compute_router_nat](https://www.terraform.io/docs/providers/google/r/compute_router_nat.html) ... Cloud NAT w/ Cloud Router

#### custom machine typeを使う
#### インスタンスでcustom machine typeを使う

例:

Expand Down

0 comments on commit b1b104b

Please sign in to comment.