$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Terraform Introduction
Search
Akira Yumiyama
April 07, 2018
Technology
0
120
Terraform Introduction
Akira Yumiyama
April 07, 2018
Tweet
Share
More Decks by Akira Yumiyama
See All by Akira Yumiyama
GAE/Python2 to Python3 Migration Journey
akiray03
0
1.8k
オブジェクト指向で考える アプリケーションアーキテクチャ設計 / Object-Oriented Conference 2020
akiray03
6
23k
Case Study of Machine Learning in CrowdWorks
akiray03
0
2k
CrowdWorksを支える管理画面 - 管理画面チラ見せ♡ナイト #5
akiray03
0
1.6k
DevSumi2015 19-D-2 IIJ社内におけるアジャイル開発、DevOpsへの取り組み
akiray03
0
450
mruby introduction -- jinbocho.rb #01
akiray03
9
1.2k
Other Decks in Technology
See All in Technology
LLM-Readyなデータ基盤を高速に構築するためのアジャイルデータモデリングの実例
kashira
0
240
regrowth_tokyo_2025_securityagent
hiashisan
0
230
Challenging Hardware Contests with Zephyr and Lessons Learned
iotengineer22
0
190
Karate+Database RiderによるAPI自動テスト導入工数をCline+GitLab MCPを使って2割削減を目指す! / 20251206 Kazuki Takahashi
shift_evolve
PRO
1
750
20251209_WAKECareer_生成AIを活用した設計・開発プロセス
syobochim
7
1.5k
CARTAのAI CoE が挑む「事業を進化させる AI エンジニアリング」 / carta ai coe evolution business ai engineering
carta_engineering
0
1.2k
Ruby で作る大規模イベントネットワーク構築・運用支援システム TTDB
taketo1113
1
290
AWS Bedrock AgentCoreで作る 1on1支援AIエージェント 〜Memory × Evaluationsによる実践開発〜
yusukeshimizu
6
400
生成AIでテスト設計はどこまでできる? 「テスト粒度」を操るテーラリング術
shota_kusaba
0
750
WordPress は終わったのか ~今のWordPress の制作手法ってなにがあんねん?~ / Is WordPress Over? How We Build with WordPress Today
tbshiki
1
750
[デモです] NotebookLM で作ったスライドの例
kongmingstrap
0
140
打 造 A I 驅 動 的 G i t H u b ⾃ 動 化 ⼯ 作 流 程
appleboy
0
320
Featured
See All Featured
Thoughts on Productivity
jonyablonski
73
5k
Building an army of robots
kneath
306
46k
Producing Creativity
orderedlist
PRO
348
40k
The Invisible Side of Design
smashingmag
302
51k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Done Done
chrislema
186
16k
Designing for Performance
lara
610
69k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
How to Ace a Technical Interview
jacobian
280
24k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Transcript
Terraform超入門 2018/4 @akiray03
Terraformとは何か https://www.terraform.io/ HashiCorpの作るインフラ構成管理ツール
Terrafromは何であって何でないのか • Terraformはインフラリソースをコード管理するツールです • Chefやansibleとは少しレイヤが違います AWS or GCP or Azure
or ... Compute Instance Compute Instance nginx ruby … nginx ruby … Chef or ansible or ..
Terraformは何をしているのか • Terraformはユーザが記述した設定ファイルに従って、APIを呼び出しているだけで す • AWSやGCPのAPI呼び出しのラッパーツール、という見方もできます • Terraformの魅力はどこにあるのでしょうか 設定ファイル (
.tf ) AWS API GCP API
Terraformの魅力(1) インフラの状態を保持する • Terraformは tfstate というJSONファイルにTerraformが操作したリソースの状態を 保存しています • tfstateに記録された状態と、現在のAWSやGCP上のリソースの状態を比較するこ とで、期待した状態との差分を計算し、期待した状態に収束するような操作(追加・
削除・変更)を実現してくれます 設定ファイル ( .tf ) AWS API GCP API tfstate
Terraformの魅力(2) 依存関係を解決してくれる • AWSやGCPでCompute Instance を起動するためには、依存するリソースが存在 している必要があります (例: ネットワークや、セキュリティ設定、等) •
起動したインスタンスのPublic IPに対してDNSレコードを設定する、という状況でも 依存関係が発生します • Terraformはこのようなリソース間の依存関係を解決し、適切な順番でAPI呼び出し を行ってくれます
Terraformの魅力(2) 依存関係を解決してくれる resource "aws_instance" "web" { ami_id = "ami-123456" instance_type
= "t2.micro" } resource "aws_route53_record" "www" { zone_id = "Z12345678" name = "abc.example.com" type = "A" ttl = "300" records = ["${aws_instance.web.public_ip}"] }
tfstateの管理 • Terraformの認識しているリソース状態はtfstateというJSONファイルに保存される • このファイルは、ローカルに配置することも、Amazon S3やGoogle Cloud Storage に保存することもできる ◦
S3やGCSに保存することで、複数人・複数端末での tfstateの共有がやりやすくなる ◦ が、同時に操作すると混乱状態になるので注意 • tfstate の単位で plan / apply することになるので、適切なサイズに分割することが 重要