Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Terraformのnull_resource ってなに?aws cli が実行できるらしい
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yuki_Kurono
January 14, 2023
Technology
1.6k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Terraformのnull_resource ってなに?aws cli が実行できるらしい
「Step Functionsからサーバレスを始めよう!! / 2023年始めLT大会!! JAWS-UGおおいた」の資料
Yuki_Kurono
January 14, 2023
More Decks by Yuki_Kurono
See All by Yuki_Kurono
Terraform(IaC)と実環境の乖離どうしていますか?
yuki_kurono
0
55
今年のre:inventから学ぶこと
yuki_kurono
0
120
re_invent 2023事前勉強会
yuki_kurono
0
110
CloudFormationの運用が 辛くならない方法を本気で考えてみた
yuki_kurono
0
380
CloudFormationで登場したForEachをちゃんと理解してみる
yuki_kurono
0
920
Turnstileのウィジェット モードとは何者か
yuki_kurono
0
740
CodeGuru Security ってなんだ?
yuki_kurono
0
1.2k
えるしってるか CloudFrontはWAFがあっても カスタムエラーレスポンスを返せる
yuki_kurono
0
460
Cloudflare初心者がIaCから基本構成を学んでみた
yuki_kurono
1
670
Other Decks in Technology
See All in Technology
トークン化預金DCJPYの取り組みと活用ユースケース
finengine
0
130
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
180
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
How to Design Configuration for Rails Applications
willnet
1
830
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
300
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
930
パッチ更新でterraform initが落ちた日
grimoh
1
140
Local CI × GitHub Actions
gogutan
2
220
事業成長とデータ活用を止めないためのマネジメントへ挑戦
hiracky16
0
400
Getting Started with Google Antigravity
glaforge
0
320
Metadata - Section 1: HTML Basics
mohab1
0
120
今さら理解するウェブフォントver.2026
takanorip
3
890
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Building Applications with DynamoDB
mza
96
7.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
Visualization
eitanlees
153
17k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
Between Models and Reality
mayunak
4
500
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Transcript
Terraformのnull_resourceってなに? aws cliが実行できるらしい 黒野 雄稀 | 2023/1/14 1 Step Functionsからサーバレスを始めよう!!
2023年始めLT大会!! JAWS-UGおおいた
自己紹介 黒野 雄稀 Yuki Kurono kurono_98 kurono アイレット株式会社 所属 普段はインフラ設計・構築や運用構築に従事
2022 APN ALL AWS Certifications Engineers 2
3 Terraformってなに?
4 null_resourceってなに? resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" }
resource "null_resource" "main" { } null_resource、その名の通り何も作らないリソースのこと。
5 これ作ってて意味あるの?? 何に使うの??無を生みだして楽しい? resource "null_resource" "main" { }
6 Google先生に聞いてみる
7 なるほど。 じゃあ、AWS CLI実行すれば リソース全部作れるじゃん! ちょっと前の僕
8 やってみた
9 だいたいこんな感じになる resource "null_resource" "vpc" { provisioner "local-exec" { interpreter
= ["/bin/bash", "-c"] command = <<EOT aws ec2 create-vpc \ --cidr-block 10.20.0.0/16 \ --tag-specifications "ResourceType=vpc, \ Tags=[{Key=Name,Value=vpc_from_null_resource}]" EOT } }
10 記述量を比較してみる リソース 記述量(普通) 記述量(null) 倍率 VPC 4行 28行 7倍
Subnet 7行 36行 約5倍 RouteTable 4行 32行 8倍 SecurityGroup 6行 36行 6倍 EC2 8行 46行 約6倍
11 辛いポイント① provisioner "local-exec" { when = destroy interpreter =
["/bin/bash", "-c"] command = <<EOT aws ec2 delete-vpc \ --vpc-id $(cat ./state/VPC_ID.txt) EOT on_failure = fail } destroy時の処理(コマンド)も記載しないとリソースが削除されない。
12 辛いポイント② リソースのId(VPCのIdとか)を保持したり取得できないので、 describeコマンドを打って、ファイル保存しておかないといけない。。
13 辛いポイント③ デプロイしてみても何作ってんのか全然わからん。。。
14 何が言いたいかというと... やれる と できるは違うよね ※本スライドの内容は完全にネタですので悪しからず。
15