2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

TerraformでGCPの操作(踏み台サーバーの作成)

Posted at

概要

Terraformを使ってGCPを操作する方法

やること

GCP上に下記構成のVM(GCE)をつくり、SSHでログインする。

DeepinScreenshot_select-area_20200315190544.png

実行方法

  • コード
    • terraform.tf: terraformバージョンなど実行環境
    • provider.tf: resource,dataなど実行するsdkバージョンの情報
    • vpc-network.tf: vpcネットワークの作成
    • subnetwork.tf: サブネットワークの作成
    • firewall.tf: ファイアウォールの作成
    • gce.tf: gceの作成

システムのデプロイ

$terraform apply

GCEへのログイン

$ gcloud compute ssh bastion

システムの破棄

$terraform destroy
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?