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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Satoshi SAKAO
May 15, 2023
Technology
370
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
Transcript
15 slides
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
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
140
JavaScriptのデバッグ/2023-09-04-llt30
ottijp
0
210
TWELITEへの誘い/2022-12-27-llt28
ottijp
0
200
ビルドツールBazelを触ってみた/2022-09-28-llt27
ottijp
0
240
HashiCorp Vaultを使ったシークレットのセキュアな一元管理 〜Ansibleを添えて〜/2022-07-12-llt26
ottijp
0
200
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
260
Other Decks in Technology
See All in Technology
HTTP通信に使おうとすると実はめんどくさいfile_get_contents
maguroalternative
0
260
Del vibe coding a un Desarrollo (agéntico) fiable
jcabot
0
220
[DBRE Summit 26] DBRE はデータベース運用をどう変えたのか
_awache
0
130
New Relicのアラート対応をClaude Codeで自動修正するワークフローを作った話
manabuseki
2
640
Test Impact Analysis を武器に立ち向かう、AI 時代のテスト増加に対するヌーラボのアプローチ / getting-started-datadog-test-impact-analysis
k6s4i53rx
3
420
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
20
29k
From vibe coding to reliable (agentic) development
jcabot
0
240
ブース設計、 お前もプロダクトだったのか / So Booth Design Was a Product All Along
akihiro0038
0
150
PHPで家庭用ゲーム機の専用コントローラーをMIDIデバイスとして扱ってみる
wind111
0
200
そのイメージ、どのCIが作った? Artifact Attestationsで来歴を固定する / Which CI system created that image? Pinning provenance with Artifact Attestations
chmikata
0
270
新規事業開発でのAWS活用成功談&失敗談! 〜新規事業開発を専門に行うRelicならではのAWS活用〜
amixedcolor
1
140
AI-DLCでソフトウェア開発の速さは 上がったのか?
rfdnxbro
0
150
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
3k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.5k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
540
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
990
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
370
YesSQL, Process and Tooling at Scale
rocio
174
15k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Speed Design
sergeychernyshev
33
2.3k
GitHub's CSS Performance
jonrohan
1033
470k
A Modern Web Designer's Workflow
chriscoyier
699
190k