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
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-l...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Satoshi SAKAO
May 15, 2023
Technology
350
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-llt29
社内のLTイベント「えるLT Vol.29 オンライン」で発表した資料です
Satoshi SAKAO
May 15, 2023
More Decks by Satoshi SAKAO
See All by Satoshi SAKAO
Testcontainers/2024-11-20-llt32
ottijp
0
120
Pkl/2024-04-17-llt31
ottijp
0
130
JavaScriptのデバッグ/2023-09-04-llt30
ottijp
0
200
TWELITEへの誘い/2022-12-27-llt28
ottijp
0
190
ビルドツールBazelを触ってみた/2022-09-28-llt27
ottijp
0
230
HashiCorp Vaultを使ったシークレットのセキュアな一元管理 〜Ansibleを添えて〜/2022-07-12-llt26
ottijp
0
190
AWSインフラのデプロイをCDKでカイゼンする/2022-03-23-llt25
ottijp
0
130
Amazon Timestreamでデータ補間/2021-12-27-llt24
ottijp
0
130
ncurses/2021-05-12-llt21
ottijp
0
250
Other Decks in Technology
See All in Technology
Code4Lib JAPANカンファレンス2026 開会挨拶 / Code4Lib JAPAN Conference 2026: Opening Remarks
ykiyota
0
330
深夜のクラウド懺悔室 1:29:300 or 1:0:0
kazzpapa3
1
230
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
460
AI-DLCって実際どう? 〜聞きたいこと全部聞いてみる〜
news_it_enj
0
260
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
2
760
AI 駆動 Terraform 開発/SRE_BizReach_MIXI_2
visional_engineering_and_design
3
2k
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
280
Sigmaで作る業務アプリ
kazushiro_honma
0
120
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
150
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
130
Omarchy Quattro の日本語設定周り
simosako
2
140
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
25k
Crafting Experiences
bethany
1
310
Designing Powerful Visuals for Engaging Learning
tmiket
1
540
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
270
Google's AI Overviews - The New Search
badams
0
1.6k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
How to Ace a Technical Interview
jacobian
281
24k
Documentation Writing (for coders)
carmenintech
77
5.5k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
540
Transcript
CDK for TerraformでAzureリソースをデプロイする Satoshi SAKAO えるLT Vol.29 2023-05-15 1
話すひと 2 🏢 インフォコム株式会社 サービスマネジメント室 👨🔧 ソフトウェアエンジニア 🛠 Node.js /
AWS / IoT / iOS (Swift) / Linux 💖 猫,テクテクライフ(ランク: 26) Satoshi SAKAO @ottijp
3 https://gmedia.playstation.com/is/image/SIEPDC/death-stranding-screen-us-11jun18-8?$2400px$
CDK is 何 • Cloud Development Kit • AWS製OSS •
CloudFormationテンプレートへのトランスパイラ 4 https://speakerdeck.com/ottijp/2022-03-23-llt25
CDKの位置付け 5 TypeScript | Python | Java | C# |
Go CDK for tf HCL JSON AWS Azure GCP etc AWS CDK CloudFormation ARM CRDs Deployment Mgr Bicep Terraform Cloud Resource IaC Hi-Level IaC Bicep JSON SAM YAML JSON entity process YAML
CDK for tf • DSLを新しく覚えることなく,使いなれたPG言語で クロスクラウドのIaCが可能. • コード補完 •
プロシージャルな処理 • モジュール化による複雑な構成への対応力 • まだα板で,ブレイキングチェンジが起こりうるので注意. 6 https://developer.hashicorp.com/terraform/cdktf#when-to-use-cdk-for-terraform
準備 7 $ npm install -g cdktf-cli $ cdktf init
--template=typescript --providers=azurerm --local
構成 8
コードの例(一部) 9 import { Construct } from 'constructs'; import {
App, TerraformStack } from 'cdktf'; import { AzurermProvider } from '@cdktf/provider-azurerm/lib/provider' import { ResourceGroup } from '@cdktf/provider-azurerm/lib/resource-group' import { VirtualNetwork } from '@cdktf/provider-azurerm/lib/virtual-network' import { Subnet } from '@cdktf/provider-azurerm/lib/subnet' import { NetworkInterface } from '@cdktf/provider-azurerm/lib/network-interface' import { PublicIp } from '@cdktf/provider-azurerm/lib/public-ip' import { LinuxVirtualMachine } from '@cdktf/provider-azurerm/lib/linux-virtual-machine' class AzureAppInfra extends TerraformStack { constructor(scope: Construct, name: string) { super(scope, name); new AzurermProvider(this, 'AzureRm', { features: {}, }) …
出力されるHCL(一部) 10 { "//": { "metadata": { "backend": "local", "stackName":
"llt", "version": "0.16.1" }, "outputs": { } }, "provider": { "azurerm": [ { "features": { } } ] }, "resource": { "azurerm_linux_virtual_machine": { "web-server": { "//": { …
デプロイ 11 $ cdktf deploy
まとめ • CDK for Terraformを利用することで AWS以外のクラウドリソースのデプロイにCDKが利用できる. • CDK for
TerraformはHCLへのトランスパイラ. • まだα版でブレイキングチェンジが起こりうるので注意. • 本当にそのプロダクトで使うべきかどうかはよく考えること. 12
13 Appendix
CDK for tfでAzureリソースをデプロイする • 環境 • terraform: v1.4.6 • cdktf:
v0.16.1(α版) • azure-cli: 2.48.1 • 前提条件 • Node(npm)がインストールされている • Terraform CLIがインストールされている • Azure CLIがインストールされていてログインしている 14
Refs • Building Azure Resources with TypeScript Using the CDK
for Terraform • https://www.hashicorp.com/blog/building-azure-resources-with-typescript-using- the-cdk-for-terraform • CDK for Terraform | Terraform | HashiCorp Developer • https://developer.hashicorp.com/terraform/cdktf • AWSインフラのデプロイをCDKでカイゼンする/2022-03-23- llt25 - Speaker Deck • https://speakerdeck.com/ottijp/2022-03-23-llt25 15