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
260
Terraformのノリを理解する
Terraformのノリを解説する資料となっています。
yuasa
November 01, 2021
Tweet
Share
More Decks by yuasa
See All by yuasa
プロンプトインジェクション2.0 : 進化する防御機構とその回避手法
melonattacker
2
560
Prompt Hardener
melonattacker
0
610
LLM活用システムの脆弱性診断内製化の取り組み
melonattacker
0
270
OpenID Connect活用時のなりすまし攻撃対策の検討 - OpenID Summit Tokyo 2024
melonattacker
0
720
OSBT: OpenID Connect Scenario-Based Tester – CODE BLUE 2023
melonattacker
0
750
JWTセキュリティ入門
melonattacker
17
13k
OIDC Scenario Based Tester (OSBT)
melonattacker
0
380
Utility Token Price Simulator
melonattacker
0
370
Hyperledger Fabricさらっとガイド
melonattacker
0
550
Featured
See All Featured
Navigating Team Friction
lara
187
15k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
GitHub's CSS Performance
jonrohan
1031
460k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
700
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