Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Terraformのノリを理解する
Search
yuasa
November 01, 2021
1
240
Terraformのノリを理解する
Terraformのノリを解説する資料となっています。
yuasa
November 01, 2021
Tweet
Share
More Decks by yuasa
See All by yuasa
Prompt Hardener
melonattacker
0
450
LLM活用システムの脆弱性診断内製化の取り組み
melonattacker
0
190
OpenID Connect活用時のなりすまし攻撃対策の検討 - OpenID Summit Tokyo 2024
melonattacker
0
630
OSBT: OpenID Connect Scenario-Based Tester – CODE BLUE 2023
melonattacker
0
680
JWTセキュリティ入門
melonattacker
17
12k
OIDC Scenario Based Tester (OSBT)
melonattacker
0
350
Utility Token Price Simulator
melonattacker
0
340
Hyperledger Fabricさらっとガイド
melonattacker
0
510
Plasma, Plasma Cash, Plasma Chamber
melonattacker
0
440
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
67
11k
Why Our Code Smells
bkeepers
PRO
336
57k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
What's in a price? How to price your products and services
michaelherold
244
12k
Docker and Python
trallard
44
3.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
GraphQLとの向き合い方2022年版
quramy
44
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
A better future with KSS
kneath
238
17k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.7k
Practical Orchestrator
shlominoach
186
10k
Visualization
eitanlees
146
15k
Transcript
Terraformのノリを理解する 2021/11/01 湯浅 1
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. ⾃⼰紹介 • 湯浅潤樹 •
名古屋⼤学B4 • Acompanyインターン⽣ • セキュリティサークルを運営 • 2時間前に親知らずを抜⻭し、喋りづらいです Twi$er: @junkitombob Twi$er: @nu_cybersec 2
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Terraformの概要 • 正式名称 :
強奪者 テラフォーム • 種類 : クリーチャー • ⽂明 : ⽔、⾃然 • 種族 : アウトレイジ • 「我こそが聖邪をあわせ持つ選ばれし...」 [1] h'ps://www.ka-nabell.com/sp/?act=sp_sell_detail&genre=7&id=100015813 3
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Terraformの概要 • IaC(Infrastructure as
Code)を実現するツール • インフラ構成をコードで管理できる • 管理画⾯でポチポチする必要がなくなる︕ • クラウドインフラ管理のHashiCorp社が提供 • AWS、Azure、GCPに対応 • .tf ファイルで構成を定義して、コマンドで簡単デプロイ 4 [2] h'ps://www.terraform.io/ [3] h'ps://www.lac.co.jp/lacwatch/service/20200903_002270.html
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Terraformのインストール • Linux •
MacOS 5 [4] Install Terraform
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Terraformのコード • クラウドのプロバイダーを指定 •
デプロイするリソースを指定 6
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Terraformの主なコマンド 主に使うコマンドは5つだけ︕ • terraform
init • ワークスペースの初期化 • プロバイダーのpluginをダウンロード • ダウンロードされたファイル群は .terraform ディレクトリ直下に配置 • terraform fmt • インフラ構成ファイルのフォーマットを整える 7 [5] h'ps://www.terraform.io/docs/cli/commands/init.html [6] h'ps://www.terraform.io/docs/cli/commands/fmt.html
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Terraformの主なコマンド • terraform validate
• インフラ構成コードの構⽂チェックをする • 記述が間違っている部分を⽰してくれる • terraform plan • 実⾏計画を⽰す • どのようなリソースが作成、修正、削除されるかを参照できる • terraform apply • plan で⽰された実⾏計画を実⾏する • 実際に構成がデプロイされる 8 [7] h'ps://www.terraform.io/docs/cli/commands/validate.html [8] h'ps://www.terraform.io/docs/cli/commands/plan.html [9] h'ps://www.terraform.io/docs/cli/commands/apply.html
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Azureの仮想マシンをデプロイしてみる 9 [11] Terraform
を使⽤して Azure で Linux VM とインフラストラクチャを構成する
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Azureの仮想マシンをデプロイしてみる 10 1. Azureにログイン
• az login コマンドで認証情報をワークスペースに提供できる 2. Terraform コードを実装する • Azureのプロバイダーを指定 • リソースグループの作成 • 仮想ネットワークとサブネットの作成 • セキュリティグループとルールの作成 • ネットワークインターフェースの作成 • SSHキーの作成 • 仮想マシンの作成
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Azureの仮想マシンをデプロイしてみる 3. Terraform を初期化する
4. Terraform 実⾏計画を作成する 11
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. Azureの仮想マシンをデプロイしてみる 5. Terraform 実⾏計画を適⽤する
12 Portal を確認するとデプロイされている SSHで仮想マシンにログインできる
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. CIへの組み込み • Github Actionsへの組み込みも簡単
• hashicorp/setup-terraform action を使⽤する 13 [12] h'ps://github.com/marketplace/acVons/hashicorp-setup-terraform
Strictly Confiden/al Copyright©株式会社Acompany All rights reserved. まとめ 強奪者 テラフォーム is
最強 14