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
250
Terraformのノリを理解する
Terraformのノリを解説する資料となっています。
yuasa
November 01, 2021
Tweet
Share
More Decks by yuasa
See All by yuasa
Prompt Hardener
melonattacker
0
570
LLM活用システムの脆弱性診断内製化の取り組み
melonattacker
0
240
OpenID Connect活用時のなりすまし攻撃対策の検討 - OpenID Summit Tokyo 2024
melonattacker
0
690
OSBT: OpenID Connect Scenario-Based Tester – CODE BLUE 2023
melonattacker
0
730
JWTセキュリティ入門
melonattacker
17
12k
OIDC Scenario Based Tester (OSBT)
melonattacker
0
370
Utility Token Price Simulator
melonattacker
0
360
Hyperledger Fabricさらっとガイド
melonattacker
0
530
Plasma, Plasma Cash, Plasma Chamber
melonattacker
0
450
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Fontdeck: Realign not Redesign
paulrobertlloyd
84
5.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
840
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
The Pragmatic Product Professional
lauravandoore
35
6.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The Cost Of JavaScript in 2023
addyosmani
49
8.1k
The Power of CSS Pseudo Elements
geoffreycrofte
76
5.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Scaling GitHub
holman
459
140k
A Tale of Four Properties
chriscoyier
159
23k
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