Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-l...
Search
Satoshi SAKAO
May 15, 2023
Technology
1
300
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-llt29
社内のLTイベント「えるLT Vol.29 オンライン」で発表した資料です
Satoshi SAKAO
May 15, 2023
Tweet
Share
More Decks by Satoshi SAKAO
See All by Satoshi SAKAO
Testcontainers/2024-11-20-llt32
ottijp
0
71
Pkl/2024-04-17-llt31
ottijp
0
100
JavaScriptのデバッグ/2023-09-04-llt30
ottijp
0
170
TWELITEへの誘い/2022-12-27-llt28
ottijp
0
170
ビルドツールBazelを触ってみた/2022-09-28-llt27
ottijp
0
190
HashiCorp Vaultを使ったシークレットのセキュアな一元管理 〜Ansibleを添えて〜/2022-07-12-llt26
ottijp
0
160
AWSインフラのデプロイをCDKでカイゼンする/2022-03-23-llt25
ottijp
0
100
Amazon Timestreamでデータ補間/2021-12-27-llt24
ottijp
0
110
ncurses/2021-05-12-llt21
ottijp
0
220
Other Decks in Technology
See All in Technology
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
9
12k
NIKKEI Tech Talk #41: セキュア・バイ・デザインからクラウド管理を考える
sekido
PRO
0
210
MariaDB Connector/C のcaching_sha2_passwordプラグインの仕様について
boro1234
0
1k
テストセンター受験、オンライン受験、どっちなんだい?
yama3133
0
170
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
210
ペアーズにおけるAIエージェント 基盤とText to SQLツールの紹介
hisamouna
2
1.7k
事業の財務責任に向き合うリクルートデータプラットフォームのFinOps
recruitengineers
PRO
2
220
AIBuildersDay_track_A_iidaxs
iidaxs
4
1.3k
アプリにAIを正しく組み込むための アーキテクチャ── 国産LLMの現実と実践
kohju
0
230
2025年のデザインシステムとAI 活用を振り返る
leveragestech
0
270
オープンソースKeycloakのMCP認可サーバの仕様の対応状況 / 20251219 OpenID BizDay #18 LT Keycloak
oidfj
0
180
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
1
770
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
190
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
110
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
200
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
29
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Crafting Experiences
bethany
0
22
How to Think Like a Performance Engineer
csswizardry
28
2.4k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
89
YesSQL, Process and Tooling at Scale
rocio
174
15k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
92
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