CDK for Terraform – Setup & Configure

CDK for Terraform – Setup & Configure

Greetings my fellow Technology Advocates and Specialists.

This is Chapter #2 of my Terraform CDK (Cloud Development Kit) Series.

In this Session, I will demonstrate How to Setup and Configure Terraform CDK (Cloud Development Kit) to define Infrastructure.

I had the Privilege to talk on this topic in ONE Azure Communities:-

NAME OF THE AZURE COMMUNITY
TYPE OF SPEAKER SESSION

Global Azure – 2024
Virtual

EVENT ANNOUNCEMENTS:-

CODE REPOSITORY:-

Terraform CDK Series with Azure:-

Greetings to my fellow Technology Advocates and Specialists.

In this Session, I talk and run Demo on TERRAFORM CDK SERIES in below TECH COMMUNITIES:-

NAME OF THE TECH COMMUNITIES:-

Global Azure – 2024

DATE
TOPICS
CONTENT

17.04.2024
CDK for Terraform – Quickstart
https://dev.to/arindam0310018/cdk-for-terraform-quickstart-1h3e

18.09.2022
CDK for Terraform – Setup & Configure
https://dev.to/arindam0310018/cdk-for-terraform-setup-configure-f42

POINTS TO NOTE:-

1. Cloud Provider is Microsoft Azure.

1. Language used here is TYPESCRIPT.

2. Browse to each folder under “03-Code-Source” (for example – Resource-Group) and look for “main.ts” for the TypeScript Code.

PRE-REQUISITES:-

1. Install Terraform.

If Required, Upgrade Terraform Version with Chocolatey Package Manager.

2. Install Node and Yarn

3. Install CDKTF

Verify CDKTF Installation

LOCAL DIRECTORY STRUCTURE FOR CODE:-

INITIALIZE CDK FOR TERRAFORM LOCALLY:-

FILES AND FOLDERS CREATED AFTER CDK FOR TERRAFORM IS INITIALIZED:-

OUTPUT OF CDKTF SYNTH:-

OUTPUT OF CDKTF DEPLOY:-

OUTPUT FROM AZURE PORTAL:-

BELOW FOLLOWS ALL THE TROUBLESHOOTING STEPS:-

ERROR #1:-

RESOLUTION:-

The Correct Command is – cdktf init –template=typescript –local

ERROR #2:-

RESOLUTION:-

In the Sytem from where you are executing terraform CDK commands, browse to “C:Program Filesnodejs”

Edit the below files, mentioned in the screenshot as per the link – https://stackoverflow.com/questions/72401421/message-npm-warn-config-global-global-local-are-deprecated-use-loc

ERROR #3:-

RESOLUTION:-

Follow the Resolution provided in the link – https://flaviocopes.com/typescript-disable-declared-never-read/

ERROR #4:-

RESOLUTION:-

Close Parenthesis was missing in the code snippet.

ERROR #5:-

RESOLUTION:-

Below Code block was missing.

new AzurermProvider(this, “AzureRm”, {
features: {},
});

ERROR #6:-

RESOLUTION:-

The Refresh token has expired due to inactivity. We need to execute “az login” command.

Hope You Enjoyed the Session!!!

Stay Safe | Keep Learning | Spread Knowledge

Leave a Reply

Your email address will not be published. Required fields are marked *