From fd4747a06f2c783239b30449b6fdf4c95e077cb1 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 15:37:29 +0200 Subject: [PATCH 01/58] fix: set specific copywrite tool version to fix CI (#3150) A manual run was successful: https://github.com/hashicorp/terraform-cdk/actions/runs/6339657436/job/17219272138 However, this has to be merged to main first to fix the PR check (due to the `pull_request_target` trigger). --- .github/workflows/pr-copyright.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-copyright.yml b/.github/workflows/pr-copyright.yml index 989da1f164..1ef423ec10 100644 --- a/.github/workflows/pr-copyright.yml +++ b/.github/workflows/pr-copyright.yml @@ -28,6 +28,8 @@ jobs: git config user.email "110428419+hashicorp-copywrite[bot]@users.noreply.github.com" - name: Setup Copywrite tool uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2 + with: + version: v0.16.4 # pinned as there's a bug causing 0.16.5 to have a different binary name which can't be loaded - name: Add headers using Copywrite tool run: copywrite headers - name: Check if there are any changes From 3b4be8e7b8ee2dcfdd41aa44bddf03a55f4638db Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 20 Sep 2023 14:57:20 +0200 Subject: [PATCH 02/58] refactor: only use exec from commons package --- .../@cdktf/provider-generator/lib/util.ts | 30 ------------------- .../provider-schema/src/provider-schema.ts | 4 ++- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/packages/@cdktf/provider-generator/lib/util.ts b/packages/@cdktf/provider-generator/lib/util.ts index 722c85aa94..37b06d57e3 100644 --- a/packages/@cdktf/provider-generator/lib/util.ts +++ b/packages/@cdktf/provider-generator/lib/util.ts @@ -1,36 +1,6 @@ // Copyright (c) HashiCorp, Inc // SPDX-License-Identifier: MPL-2.0 -import * as fs from "fs-extra"; -import * as os from "os"; -import * as path from "path"; - -export async function withTempDir( - dirname: string, - closure: () => Promise -) { - const prevdir = process.cwd(); - const parent = await fs.mkdtemp(path.join(os.tmpdir(), "cdktf.")); - const workdir = path.join(parent, dirname); - await fs.mkdirp(workdir); - try { - process.chdir(workdir); - await closure(); - } finally { - process.chdir(prevdir); - await fs.remove(parent); - } -} - -export async function mkdtemp(closure: (dir: string) => Promise) { - const workdir = await fs.mkdtemp(path.join(os.tmpdir(), "cdktf.")); - try { - await closure(workdir); - } finally { - await fs.remove(workdir); - } -} - /** * Downcase the first character in a string. * diff --git a/packages/@cdktf/provider-schema/src/provider-schema.ts b/packages/@cdktf/provider-schema/src/provider-schema.ts index a1c2d53288..02f5f53883 100644 --- a/packages/@cdktf/provider-schema/src/provider-schema.ts +++ b/packages/@cdktf/provider-schema/src/provider-schema.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MPL-2.0 import * as fs from "fs-extra"; import * as path from "path"; -import { exec, withTempDir } from "./util"; + import { convertFiles } from "@cdktf/hcl2json"; import { ConstructsMakerModuleTarget, @@ -12,6 +12,8 @@ import { ModuleSchema, ProviderSchema, VersionSchema, + exec, + withTempDir } from "@cdktf/commons"; const terraformBinaryName = process.env.TERRAFORM_BINARY_NAME || "terraform"; From 4f16a69c662397a2fa026de79583c86bc2ad772e Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 20 Sep 2023 15:13:48 +0200 Subject: [PATCH 03/58] fix: make sure noColor option is honored --- .../@cdktf/cli-core/src/lib/cdktf-project.ts | 5 +- .../cli-core/src/lib/models/terraform-cli.ts | 4 ++ .../@cdktf/cli-core/src/lib/synth-stack.ts | 2 + packages/@cdktf/commons/src/util.ts | 53 ++++++++++++------- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts index 853aab95a1..f4c500ef32 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts @@ -348,7 +348,7 @@ export class CdktfProject { ); } - public async synth() { + public async synth(noColor?: boolean) { this.onUpdate({ type: "synthesizing", }); @@ -358,6 +358,7 @@ export class CdktfProject { this.outDir, this.workingDirectory, false, + noColor, this.synthOrigin ); @@ -386,7 +387,7 @@ export class CdktfProject { public async diff(opts: DiffOptions = {}) { const stacks = opts.skipSynth ? await this.readSynthesizedStacks() - : await this.synth(); + : await this.synth(opts.noColor); const stack = this.getStackExecutor( getSingleStack(stacks, opts?.stackName, "diff") ); diff --git a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts index 4fe7e48df0..7d4f551430 100644 --- a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts +++ b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts @@ -180,6 +180,7 @@ export class TerraformCli implements Terraform { cwd: this.workdir, env: process.env, signal: this.abortSignal, + noColor: opts.noColor, }, this.onStdout("init"), this.onStderr("init") @@ -249,6 +250,7 @@ export class TerraformCli implements Terraform { cwd: this.workdir, env: process.env, signal: this.abortSignal, + noColor, }, this.onStdout("plan", [VariableRequiredFilter]), this.onStderr("plan", [VariableRequiredFilter]) @@ -411,6 +413,7 @@ export class TerraformCli implements Terraform { cwd: this.workdir, env: process.env, signal: this.abortSignal, + noColor: true, }, this.onStdout("version"), this.onStderr("version") @@ -430,6 +433,7 @@ export class TerraformCli implements Terraform { cwd: this.workdir, env: process.env, signal: this.abortSignal, + noColor: true, }, // We don't need to log the output here since we use it later on () => {}, // eslint-disable-line @typescript-eslint/no-empty-function diff --git a/packages/@cdktf/cli-core/src/lib/synth-stack.ts b/packages/@cdktf/cli-core/src/lib/synth-stack.ts index 8b940a0e64..f52bf10686 100644 --- a/packages/@cdktf/cli-core/src/lib/synth-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/synth-stack.ts @@ -70,6 +70,7 @@ export class SynthStack { outdir: string, workingDirectory = process.cwd(), graceful = false, // will not exit the process but rethrow the error instead + noColor = false, synthOrigin?: SynthOrigin ): Promise { // start performance timer @@ -120,6 +121,7 @@ might fail while synthesizing with an out of memory error.`); }, cwd: workingDirectory, signal: abortSignal, + noColor: noColor, }); } catch (e: any) { const errorOutput = chalkColour`{redBright cdktf encountered an error while synthesizing} diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index d96d5f3865..f7935eea67 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -9,11 +9,12 @@ import * as path from "path"; import { processLoggerError, processLoggerDebug } from "./logging"; import { IManifest, Manifest } from "cdktf"; import * as config from "./config"; +import stripAnsi from "strip-ansi"; export async function shell( program: string, args: string[] = [], - options: SpawnOptions = {} + options: SpawnOptions & { noColor?: boolean } = {} ) { const stderr = new Array(); const stdout = new Array(); @@ -22,9 +23,9 @@ export async function shell( program, args, options, - (chunk: Buffer) => { - stdout.push(chunk.toString()); - console.log(chunk.toString()); + (chunk: string) => { + stdout.push(chunk); + console.log(chunk); }, (chunk: string | Uint8Array) => stderr.push(chunk) ); @@ -68,42 +69,54 @@ export async function mkdtemp(closure: (dir: string) => Promise) { export const exec = async ( command: string, args: string[], - options: SpawnOptions, - stdout?: (chunk: Buffer) => any, + options: SpawnOptions & { noColor?: boolean }, + stdout?: (chunk: string) => any, stderr?: (chunk: string | Uint8Array) => any, sendToStderr = true ): Promise => { return new Promise((ok, ko) => { const child = spawn(command, args, options); - const out = new Array(); - const err = new Array(); + const out = new Array(); + const err = new Array(); if (stdout !== undefined) { child.stdout?.on("data", (chunk: Buffer) => { - processLoggerDebug(chunk); - out.push(chunk); - stdout(chunk); + const sanitizedChunk = options.noColor + ? stripAnsi(chunk.toLocaleString()) + : chunk.toLocaleString(); + processLoggerDebug(sanitizedChunk); + out.push(sanitizedChunk); + stdout(sanitizedChunk); }); } else { child.stdout?.on("data", (chunk: Buffer) => { - processLoggerDebug(chunk); - out.push(chunk); + const sanitizedChunk = options.noColor + ? stripAnsi(chunk.toLocaleString()) + : chunk.toLocaleString(); + processLoggerDebug(sanitizedChunk); + out.push(sanitizedChunk); }); } if (stderr !== undefined) { child.stderr?.on("data", (chunk: string | Uint8Array) => { - processLoggerError(chunk); + const sanitizedChunk = options.noColor + ? stripAnsi(chunk.toLocaleString()) + : chunk.toLocaleString(); + processLoggerError(sanitizedChunk); if (sendToStderr) { - stderr(chunk); + stderr(sanitizedChunk); } - err.push(chunk); + err.push(sanitizedChunk); }); } else { child.stderr?.on("data", (chunk: string | Uint8Array) => { - processLoggerError(chunk); + const sanitizedChunk = options.noColor + ? stripAnsi(chunk.toLocaleString()) + : chunk.toLocaleString(); + processLoggerError(sanitizedChunk); if (sendToStderr) { - process.stderr.write(chunk); + process.stderr.write(sanitizedChunk); } - err.push(chunk); + err.push(sanitizedChunk); }); } child.once("error", (err: any) => ko(err)); @@ -113,7 +126,7 @@ export const exec = async ( (error as any).stderr = err.map((chunk) => chunk.toString()).join(""); return ko(error); } - return ok(Buffer.concat(out).toString("utf-8")); + return ok(out.join("")); }); }); }; From db91e2d8077bb7801c5ea2e95a0fa5c09ce2b173 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 20 Sep 2023 20:27:17 +0200 Subject: [PATCH 04/58] chore: add logs for better debugging --- test/csharp/no-color-command-option-test/test.ts | 6 ++++++ test/go/no-color-command-option-test/test.ts | 6 ++++++ test/java/no-color-command-option-test/test.ts | 6 ++++++ test/python/no-color-command-option-test/test.ts | 6 ++++++ test/typescript/no-color-command-option-test/test.ts | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/test/csharp/no-color-command-option-test/test.ts b/test/csharp/no-color-command-option-test/test.ts index 206d36e512..dea3d897b5 100644 --- a/test/csharp/no-color-command-option-test/test.ts +++ b/test/csharp/no-color-command-option-test/test.ts @@ -22,6 +22,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf diff", async () => { @@ -29,6 +31,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { env: driver.env, cwd: driver.workingDirectory, }); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf destroy", async () => { @@ -40,6 +44,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); }); diff --git a/test/go/no-color-command-option-test/test.ts b/test/go/no-color-command-option-test/test.ts index a3122ef4ed..8c5ca74c38 100644 --- a/test/go/no-color-command-option-test/test.ts +++ b/test/go/no-color-command-option-test/test.ts @@ -22,6 +22,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf diff", async () => { @@ -29,6 +31,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { env: driver.env, cwd: driver.workingDirectory, }); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf destroy", async () => { @@ -40,6 +44,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); }); diff --git a/test/java/no-color-command-option-test/test.ts b/test/java/no-color-command-option-test/test.ts index d8cd3eb670..22c12422a4 100644 --- a/test/java/no-color-command-option-test/test.ts +++ b/test/java/no-color-command-option-test/test.ts @@ -25,6 +25,8 @@ describe.skip("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf diff", async () => { @@ -32,6 +34,8 @@ describe.skip("no-color option for cdktf deploy, diff, destroy", () => { env: driver.env, cwd: driver.workingDirectory, }); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf destroy", async () => { @@ -43,6 +47,8 @@ describe.skip("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); }); diff --git a/test/python/no-color-command-option-test/test.ts b/test/python/no-color-command-option-test/test.ts index a7cf33f7a2..72e684314e 100644 --- a/test/python/no-color-command-option-test/test.ts +++ b/test/python/no-color-command-option-test/test.ts @@ -22,6 +22,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf diff", async () => { @@ -29,6 +31,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { env: driver.env, cwd: driver.workingDirectory, }); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf destroy", async () => { @@ -40,6 +44,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); }); diff --git a/test/typescript/no-color-command-option-test/test.ts b/test/typescript/no-color-command-option-test/test.ts index 1007076f1a..c1d29c55e8 100644 --- a/test/typescript/no-color-command-option-test/test.ts +++ b/test/typescript/no-color-command-option-test/test.ts @@ -20,6 +20,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf diff", async () => { @@ -27,6 +29,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { env: driver.env, cwd: driver.workingDirectory, }); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); onPosix("contains no color formatting in cdktf destroy", async () => { @@ -38,6 +42,8 @@ describe("no-color option for cdktf deploy, diff, destroy", () => { cwd: driver.workingDirectory, } ); + // These tests are sometimes flaky, therefore we log the result here to ensure we can debug it properly + console.log(result.stdout); expect(hasAnsi(result.stdout)).toBe(false); }); }); From 6d951de75e57a09266ee1cd21c903360bb162a1f Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 08:49:30 +0200 Subject: [PATCH 05/58] WIP --- packages/@cdktf/cli-core/src/lib/synth-stack.ts | 2 ++ packages/@cdktf/commons/src/util.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/packages/@cdktf/cli-core/src/lib/synth-stack.ts b/packages/@cdktf/cli-core/src/lib/synth-stack.ts index f52bf10686..99c41b1a65 100644 --- a/packages/@cdktf/cli-core/src/lib/synth-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/synth-stack.ts @@ -112,6 +112,7 @@ might fail while synthesizing with an out of memory error.`); } try { + console.log("Synth started", noColor); await shell(command, [], { shell: true, env: { @@ -123,6 +124,7 @@ might fail while synthesizing with an out of memory error.`); signal: abortSignal, noColor: noColor, }); + console.log("Synth finished"); } catch (e: any) { const errorOutput = chalkColour`{redBright cdktf encountered an error while synthesizing} diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index f7935eea67..f222b09138 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -74,6 +74,11 @@ export const exec = async ( stderr?: (chunk: string | Uint8Array) => any, sendToStderr = true ): Promise => { + console.log( + `Running: ${command} ${args.join(" ")} with no color being ${ + options.noColor ? "enabled" : "disabled" + }` + ); return new Promise((ok, ko) => { const child = spawn(command, args, options); const out = new Array(); From d9fa186e179cabecfebbc4f190a3f9b2929b1826 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 11:34:39 +0200 Subject: [PATCH 06/58] WIP --- packages/@cdktf/cli-core/src/lib/cdktf-project.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts index f4c500ef32..ceb9955049 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts @@ -349,6 +349,7 @@ export class CdktfProject { } public async synth(noColor?: boolean) { + console.log("project synth", { noColor }); this.onUpdate({ type: "synthesizing", }); @@ -385,6 +386,7 @@ export class CdktfProject { } public async diff(opts: DiffOptions = {}) { + console.log("project diff", opts); const stacks = opts.skipSynth ? await this.readSynthesizedStacks() : await this.synth(opts.noColor); From f9f6537cabb45be36ede97cf5714ba8797380e93 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 11:42:55 +0200 Subject: [PATCH 07/58] chore: update uuid --- packages/@cdktf/commons/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@cdktf/commons/package.json b/packages/@cdktf/commons/package.json index 0869698e69..fe6721af74 100644 --- a/packages/@cdktf/commons/package.json +++ b/packages/@cdktf/commons/package.json @@ -43,7 +43,7 @@ "fs-extra": "^11.1.1", "is-valid-domain": "^0.1.6", "log4js": "^6.9.1", - "uuid": "^9.0.0" + "uuid": "^9.0.1" }, "devDependencies": { "@types/follow-redirects": "^1.14.1", diff --git a/yarn.lock b/yarn.lock index 6261b5bf9e..2278136280 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11872,10 +11872,10 @@ uuid@8.3.2, uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -uuid@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== +uuid@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== v8-compile-cache-lib@^3.0.1: version "3.0.1" From 05e8003e618f41efca0a072812ea64bc585da8d4 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 12:15:59 +0200 Subject: [PATCH 08/58] WIP --- packages/@cdktf/cli-core/src/lib/cdktf-project.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts index ceb9955049..ff647de132 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts @@ -485,6 +485,7 @@ export class CdktfProject { } public async deploy(opts: MutationOptions = {}) { + console.log("project deploy", opts); const stacks = opts.skipSynth ? await this.readSynthesizedStacks() : await this.synth(); From dd2937ca3da61df61854bb093eff677a1ef9c386 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 14:57:10 +0200 Subject: [PATCH 09/58] fix: pass noColor flag --- packages/@cdktf/cli-core/src/lib/cdktf-project.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts index ff647de132..77df013634 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts @@ -488,7 +488,7 @@ export class CdktfProject { console.log("project deploy", opts); const stacks = opts.skipSynth ? await this.readSynthesizedStacks() - : await this.synth(); + : await this.synth(opts.noColor); const stacksToRun = getMultipleStacks(stacks, opts.stackNames, "deploy"); if (!opts.ignoreMissingStackDependencies) { checkIfAllDependenciesAreIncluded(stacksToRun); @@ -546,7 +546,7 @@ export class CdktfProject { public async destroy(opts: MutationOptions = {}) { const stacks = opts.skipSynth ? await this.readSynthesizedStacks() - : await this.synth(); + : await this.synth(opts.noColor); const stacksToRun = getMultipleStacks(stacks, opts.stackNames, "destroy"); if (!opts.ignoreMissingStackDependencies) { From 5a386a8c90ed8ed09f933b5d43f52cf7e5c583c0 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 17:08:03 +0200 Subject: [PATCH 10/58] fix: use no-color in shell --- packages/@cdktf/commons/src/util.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index f222b09138..72da25cf18 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -24,10 +24,18 @@ export async function shell( args, options, (chunk: string) => { - stdout.push(chunk); - console.log(chunk); + const sanitizedChunk = options.noColor + ? stripAnsi(chunk.toLocaleString()) + : chunk.toLocaleString(); + stdout.push(sanitizedChunk); + console.log(sanitizedChunk); }, - (chunk: string | Uint8Array) => stderr.push(chunk) + (chunk: string | Uint8Array) => { + const sanitizedChunk = options.noColor + ? stripAnsi(chunk.toLocaleString()) + : chunk.toLocaleString(); + stderr.push(sanitizedChunk); + } ); } catch (e: any) { if (stderr.length > 0) { From 720addef30972d384b109353da8d2c92504a8bf2 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 21 Sep 2023 17:29:36 +0200 Subject: [PATCH 11/58] fix: strip all ansis --- packages/@cdktf/commons/src/util.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index 72da25cf18..fa75ca9089 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -40,9 +40,15 @@ export async function shell( } catch (e: any) { if (stderr.length > 0) { e.stderr = stderr.map((chunk) => chunk.toString()).join(""); + if (options.noColor) { + e.stderr = stripAnsi(e.stderr); + } } if (stdout.length > 0) { e.stdout = stdout.join(""); + if (options.noColor) { + e.stdout = stripAnsi(e.stdout); + } } throw e; } From 731eb9464db87975082448fc70fd078d80f9032b Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Wed, 27 Sep 2023 14:55:05 +0200 Subject: [PATCH 12/58] fix: stringify provider constraint to properly print object in log message --- .../lib/get/generator/provider-generator.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@cdktf/provider-generator/lib/get/generator/provider-generator.ts b/packages/@cdktf/provider-generator/lib/get/generator/provider-generator.ts index 57777b5fe2..7863ff0d83 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/provider-generator.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/provider-generator.ts @@ -79,7 +79,9 @@ export class TerraformProviderGenerator { )}` ); throw new Error( - `Could not find provider with constraint ${providerConstraint}` + `Could not find provider with constraint ${JSON.stringify( + providerConstraint + )}` ); } From 04509edb3223ea3ff0273f1df70b627e8e8af507 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Wed, 27 Sep 2023 15:15:55 +0200 Subject: [PATCH 13/58] fix(cli): infer noColor from flag or env for calls like collectDebugInformation() that run before CLI commands --- packages/@cdktf/commons/src/util.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index fa75ca9089..cadc61cafd 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -88,6 +88,12 @@ export const exec = async ( stderr?: (chunk: string | Uint8Array) => any, sendToStderr = true ): Promise => { + // if options.noColor is not set, checking the flags & environment if it should be set + // This is required for collectDebugInformation() which does not have knowledge about flags + if (typeof options.noColor !== "boolean" && hasNoColorFlagOrEnv()) { + options.noColor = true; + } + console.log( `Running: ${command} ${args.join(" ")} with no color being ${ options.noColor ? "enabled" : "disabled" @@ -243,3 +249,26 @@ export async function ensureAllSettledBeforeThrowing( throw e; } } + +/** + * returns true if --no-color is passed as CLI flag or the env var FORCE_COLOR is set to "0" + * Used for cases where we can't pass down the noColor flag (e.g. when collecting debug information from the environment) + * This is the same behavior as the `chalk` lib we use for coloring output + */ +function hasNoColorFlagOrEnv(): boolean { + return hasFlag("no-color") || process.env.FORCE_COLOR === "0" +} + +// From: https://github.com/sindresorhus/has-flag/blob/main/index.js +// as used in https://github.com/chalk/chalk +function hasFlag( + flag: string +) { + const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; + const position = process.argv.indexOf(prefix + flag); + const terminatorPosition = process.argv.indexOf("--"); + return ( + position !== -1 && + (terminatorPosition === -1 || position < terminatorPosition) + ); +} From 56d731dc2a1cca4f992c3f0ed9c4ecd6864a0677 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Wed, 27 Sep 2023 15:35:50 +0200 Subject: [PATCH 14/58] fix(provider-generator): fix import after rebasing --- .../lib/__tests__/edge-provider-schema.test.ts | 2 +- .../provider-generator/lib/__tests__/provider.test.ts | 2 +- .../@cdktf/provider-generator/lib/get/__tests__/util.ts | 7 +++++-- .../@cdktf/provider-generator/lib/get/constructs-maker.ts | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/@cdktf/provider-generator/lib/__tests__/edge-provider-schema.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/edge-provider-schema.test.ts index e16cec8347..3bbc57c456 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/edge-provider-schema.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/edge-provider-schema.test.ts @@ -3,7 +3,7 @@ import * as fs from "fs-extra"; import * as path from "path"; import { generateProviderBindingsFromSchema } from ".."; -import { mkdtemp } from "../util"; +import { mkdtemp } from "@cdktf/commons"; import { edgeSchema } from "./edge-provider-schema"; describe("Edge Provider Schema", () => { diff --git a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts index a09ecf4d92..98745ddc5b 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts @@ -3,7 +3,7 @@ import * as path from "path"; import * as fs from "fs-extra"; import { glob } from "glob"; -import { mkdtemp } from "../util"; +import { mkdtemp } from "@cdktf/commons"; import { ConstructsMaker } from "../get/constructs-maker"; import { Language, TerraformProviderConstraint } from "@cdktf/commons"; diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/util.ts b/packages/@cdktf/provider-generator/lib/get/__tests__/util.ts index a15dc10d21..b0c6354bdc 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/util.ts +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/util.ts @@ -1,8 +1,11 @@ // Copyright (c) HashiCorp, Inc // SPDX-License-Identifier: MPL-2.0 import * as fs from "fs"; -import { withTempDir } from "../../util"; -import { Language, TerraformModuleConstraint } from "@cdktf/commons"; +import { + Language, + TerraformModuleConstraint, + withTempDir, +} from "@cdktf/commons"; import { ConstructsMaker } from "../constructs-maker"; import * as path from "path"; diff --git a/packages/@cdktf/provider-generator/lib/get/constructs-maker.ts b/packages/@cdktf/provider-generator/lib/get/constructs-maker.ts index 45e395491e..60b34b0381 100644 --- a/packages/@cdktf/provider-generator/lib/get/constructs-maker.ts +++ b/packages/@cdktf/provider-generator/lib/get/constructs-maker.ts @@ -3,7 +3,7 @@ import * as fs from "fs-extra"; import * as path from "path"; import { CodeMaker } from "codemaker"; -import { mkdtemp } from "../util"; +import { mkdtemp } from "@cdktf/commons"; import * as srcmak from "jsii-srcmak"; import { TerraformDependencyConstraint, From 79bf877243691f569ff7c4745aed84c09c55e67d Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Wed, 27 Sep 2023 15:55:00 +0200 Subject: [PATCH 15/58] fix: run prettier --- packages/@cdktf/commons/src/util.ts | 6 ++---- packages/@cdktf/provider-schema/src/provider-schema.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index cadc61cafd..52e7e4a163 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -256,14 +256,12 @@ export async function ensureAllSettledBeforeThrowing( * This is the same behavior as the `chalk` lib we use for coloring output */ function hasNoColorFlagOrEnv(): boolean { - return hasFlag("no-color") || process.env.FORCE_COLOR === "0" + return hasFlag("no-color") || process.env.FORCE_COLOR === "0"; } // From: https://github.com/sindresorhus/has-flag/blob/main/index.js // as used in https://github.com/chalk/chalk -function hasFlag( - flag: string -) { +function hasFlag(flag: string) { const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; const position = process.argv.indexOf(prefix + flag); const terminatorPosition = process.argv.indexOf("--"); diff --git a/packages/@cdktf/provider-schema/src/provider-schema.ts b/packages/@cdktf/provider-schema/src/provider-schema.ts index 02f5f53883..0ab3e2b402 100644 --- a/packages/@cdktf/provider-schema/src/provider-schema.ts +++ b/packages/@cdktf/provider-schema/src/provider-schema.ts @@ -13,7 +13,7 @@ import { ProviderSchema, VersionSchema, exec, - withTempDir + withTempDir, } from "@cdktf/commons"; const terraformBinaryName = process.env.TERRAFORM_BINARY_NAME || "terraform"; From 4a3c743c3dd67b83ebd701125528021a95cc73ee Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 10:00:44 +0200 Subject: [PATCH 16/58] fix: remove console log that breaks tests --- packages/@cdktf/commons/src/util.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index 52e7e4a163..2f06d8b63f 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -94,11 +94,6 @@ export const exec = async ( options.noColor = true; } - console.log( - `Running: ${command} ${args.join(" ")} with no color being ${ - options.noColor ? "enabled" : "disabled" - }` - ); return new Promise((ok, ko) => { const child = spawn(command, args, options); const out = new Array(); From 1075e8fa32714c799586894707d70dbb6ffc8bef Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 10:13:03 +0200 Subject: [PATCH 17/58] fix: remove more stray console log statements --- packages/@cdktf/cli-core/src/lib/cdktf-project.ts | 3 --- packages/@cdktf/cli-core/src/lib/synth-stack.ts | 2 -- 2 files changed, 5 deletions(-) diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts index 77df013634..fd8a72e4f6 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts @@ -349,7 +349,6 @@ export class CdktfProject { } public async synth(noColor?: boolean) { - console.log("project synth", { noColor }); this.onUpdate({ type: "synthesizing", }); @@ -386,7 +385,6 @@ export class CdktfProject { } public async diff(opts: DiffOptions = {}) { - console.log("project diff", opts); const stacks = opts.skipSynth ? await this.readSynthesizedStacks() : await this.synth(opts.noColor); @@ -485,7 +483,6 @@ export class CdktfProject { } public async deploy(opts: MutationOptions = {}) { - console.log("project deploy", opts); const stacks = opts.skipSynth ? await this.readSynthesizedStacks() : await this.synth(opts.noColor); diff --git a/packages/@cdktf/cli-core/src/lib/synth-stack.ts b/packages/@cdktf/cli-core/src/lib/synth-stack.ts index 99c41b1a65..f52bf10686 100644 --- a/packages/@cdktf/cli-core/src/lib/synth-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/synth-stack.ts @@ -112,7 +112,6 @@ might fail while synthesizing with an out of memory error.`); } try { - console.log("Synth started", noColor); await shell(command, [], { shell: true, env: { @@ -124,7 +123,6 @@ might fail while synthesizing with an out of memory error.`); signal: abortSignal, noColor: noColor, }); - console.log("Synth finished"); } catch (e: any) { const errorOutput = chalkColour`{redBright cdktf encountered an error while synthesizing} From ed71523e5e83271c3697d00d570080b53547c9f4 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 10:47:24 +0200 Subject: [PATCH 18/58] wip - console log debugging --- packages/@cdktf/commons/src/util.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index 2f06d8b63f..67e5168b6a 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -90,6 +90,10 @@ export const exec = async ( ): Promise => { // if options.noColor is not set, checking the flags & environment if it should be set // This is required for collectDebugInformation() which does not have knowledge about flags + if (typeof options.noColor !== "boolean") { + console.log("no nocolor set", "setting it to", hasNoColorFlagOrEnv(), "args", process.argv); + } + if (typeof options.noColor !== "boolean" && hasNoColorFlagOrEnv()) { options.noColor = true; } From b52279c632b8a50f5069d93509f2251298853b0d Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 12:41:45 +0200 Subject: [PATCH 19/58] fix: fix test that relied on a mocked exec that didnt intend to mock all exec calls --- .../src/test/lib/terraform-parallelism.test.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/@cdktf/cli-core/src/test/lib/terraform-parallelism.test.ts b/packages/@cdktf/cli-core/src/test/lib/terraform-parallelism.test.ts index 8c49859943..5675e62b5b 100644 --- a/packages/@cdktf/cli-core/src/test/lib/terraform-parallelism.test.ts +++ b/packages/@cdktf/cli-core/src/test/lib/terraform-parallelism.test.ts @@ -10,16 +10,20 @@ import { CdktfProject, init, get } from "../../lib/index"; import { spawn } from "@cdktf/node-pty-prebuilt-multiarch"; import { exec, Language } from "@cdktf/commons"; +// this is required for the get() call in beforeAll() to work +let execMockActive = false; + jest.mock("@cdktf/commons", () => { const originalModule = jest.requireActual("@cdktf/commons"); return { __esmodule: true, ...originalModule, - // exec: jest.fn().mockImplementation(originalModule.exec), - exec: jest.fn().mockImplementation(async (_binary, _args) => { + exec: jest.fn().mockImplementation(async (...args: any[]) => { // Fake all commands that we invoke - return Promise.resolve(JSON.stringify({})); + + if (execMockActive) return Promise.resolve(JSON.stringify({})); + return originalModule.exec(...args); }), }; }); @@ -127,6 +131,8 @@ describe("terraform parallelism", () => { process.env.CDKTF_EXPERIMENTAL_PROVIDER_SCHEMA_CACHE_PATH, }); + execMockActive = true; + inNewWorkingDirectory = function inNewWorkingDirectory() { const wd = fs.mkdtempSync(path.join(os.tmpdir(), "cdktf.")); const outDir = path.resolve(wd, "out"); From 6f8578d04c402ae1a5517162a93b66f90f9957ba Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 12:47:31 +0200 Subject: [PATCH 20/58] wip --- packages/@cdktf/commons/src/debug.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/@cdktf/commons/src/debug.ts b/packages/@cdktf/commons/src/debug.ts index 1f12f3d73c..11aa37505d 100644 --- a/packages/@cdktf/commons/src/debug.ts +++ b/packages/@cdktf/commons/src/debug.ts @@ -391,7 +391,9 @@ export async function collectDebugInformation() { switch (language) { case "python": { + console.log("about to get python version") const python = getPythonVersion(); + console.log("got python version") const pip = getPipVersion(); const pipenv = getPipenvVersion(); debugOutput["python"] = (await python) ?? null; From d125a25b25fda56384f55dd2d1ec3b8eb2ad861f Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 14:51:31 +0200 Subject: [PATCH 21/58] fix: logger should not print with colors if colors are disabled --- packages/@cdktf/commons/src/logging.ts | 8 ++++++++ packages/@cdktf/commons/src/util.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/@cdktf/commons/src/logging.ts b/packages/@cdktf/commons/src/logging.ts index 4e25045583..64a9a986dc 100644 --- a/packages/@cdktf/commons/src/logging.ts +++ b/packages/@cdktf/commons/src/logging.ts @@ -4,6 +4,7 @@ import { configure, getLogger } from "log4js"; import * as fs from "fs-extra"; import * as path from "path"; import * as Sentry from "@sentry/node"; +import { hasNoColorFlagOrEnv } from "./util"; const cliLogger = getLogger(); const logger = { @@ -81,6 +82,13 @@ if ( }, categories: { default: { appenders: ["cdktf"], level: "debug" } }, }); +} else { + const layoutType = hasNoColorFlagOrEnv() ? "basic" : "colored"; + + configure({ + appenders: { out: { type: "stdout", layout: { type: layoutType } } }, + categories: { default: { appenders: ["out"], level: "info" } }, + }); } const processLoggerDebug = (chunk: Buffer | string | Uint8Array) => { diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index 67e5168b6a..7825b8e6d6 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -254,7 +254,7 @@ export async function ensureAllSettledBeforeThrowing( * Used for cases where we can't pass down the noColor flag (e.g. when collecting debug information from the environment) * This is the same behavior as the `chalk` lib we use for coloring output */ -function hasNoColorFlagOrEnv(): boolean { +export function hasNoColorFlagOrEnv(): boolean { return hasFlag("no-color") || process.env.FORCE_COLOR === "0"; } From 3d3ae7a88488c536f22f3a2d5b8ffeadd252d320 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 15:09:57 +0200 Subject: [PATCH 22/58] chore: remove old console logs --- packages/@cdktf/commons/src/debug.ts | 2 -- packages/@cdktf/commons/src/util.ts | 4 ---- 2 files changed, 6 deletions(-) diff --git a/packages/@cdktf/commons/src/debug.ts b/packages/@cdktf/commons/src/debug.ts index 11aa37505d..1f12f3d73c 100644 --- a/packages/@cdktf/commons/src/debug.ts +++ b/packages/@cdktf/commons/src/debug.ts @@ -391,9 +391,7 @@ export async function collectDebugInformation() { switch (language) { case "python": { - console.log("about to get python version") const python = getPythonVersion(); - console.log("got python version") const pip = getPipVersion(); const pipenv = getPipenvVersion(); debugOutput["python"] = (await python) ?? null; diff --git a/packages/@cdktf/commons/src/util.ts b/packages/@cdktf/commons/src/util.ts index 7825b8e6d6..95b13bf26d 100644 --- a/packages/@cdktf/commons/src/util.ts +++ b/packages/@cdktf/commons/src/util.ts @@ -90,10 +90,6 @@ export const exec = async ( ): Promise => { // if options.noColor is not set, checking the flags & environment if it should be set // This is required for collectDebugInformation() which does not have knowledge about flags - if (typeof options.noColor !== "boolean") { - console.log("no nocolor set", "setting it to", hasNoColorFlagOrEnv(), "args", process.argv); - } - if (typeof options.noColor !== "boolean" && hasNoColorFlagOrEnv()) { options.noColor = true; } From 7687d936e6625fbe4c06a4f06d1b2aee26b9dc20 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 28 Sep 2023 18:17:11 +0200 Subject: [PATCH 23/58] fix: unpin version of copywrite `0.16.6` has been released which fixes the problem why we pinned this version in #3150 --- .github/workflows/pr-copyright.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-copyright.yml b/.github/workflows/pr-copyright.yml index 1ef423ec10..989da1f164 100644 --- a/.github/workflows/pr-copyright.yml +++ b/.github/workflows/pr-copyright.yml @@ -28,8 +28,6 @@ jobs: git config user.email "110428419+hashicorp-copywrite[bot]@users.noreply.github.com" - name: Setup Copywrite tool uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2 - with: - version: v0.16.4 # pinned as there's a bug causing 0.16.5 to have a different binary name which can't be loaded - name: Add headers using Copywrite tool run: copywrite headers - name: Check if there are any changes From b18b4208e6915ddfa3722898bcd88dac736b81c3 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Fri, 29 Sep 2023 12:21:24 +0200 Subject: [PATCH 24/58] fix: fix Github workflow caches to restore successfully more often --- .github/workflows/build.yml | 25 +++-- .github/workflows/examples.yml | 38 +++++-- .github/workflows/integration.yml | 109 ++++++++++++++++----- .github/workflows/provider-integration.yml | 94 ++++++++++++++---- .github/workflows/unit.yml | 24 +++-- .github/workflows/yarn-upgrade.yml | 6 +- 6 files changed, 225 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bedc5e591..7a3c07c383 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,14 +27,26 @@ jobs: run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk - name: ensure correct user run: chown -R root /__w/terraform-cdk - - name: Get yarn cache directory path + # Setup caches for yarn, and go + - name: Get cache directory paths id: global-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-build + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: - path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + path: ${{ steps.global-cache-dir-path.outputs.go }} + key: go-${{ runner.os }}-build + restore-keys: | + go-${{ runner.os }}- - name: install dependencies run: yarn install - name: build and package @@ -43,5 +55,4 @@ jobs: yarn package env: SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 9733580cb5..5fbdeb5639 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -50,16 +50,34 @@ jobs: run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk - name: ensure correct user run: chown -R root /__w/terraform-cdk - - name: Get yarn cache directory path + # Setup caches for yarn, terraform, and go + - name: Get cache directory paths id: global-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/terraform + echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-examples + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.terraform }} + key: terraform-${{ runner.os }}-${{ matrix.terraform }}-examples + restore-keys: | + terraform-${{ runner.os }}-${{ matrix.terraform }} - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: - path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-examples-yarn-${{ hashFiles('**/yarn.lock') }} + path: ${{ steps.global-cache-dir-path.outputs.go }} + key: go-${{ runner.os }}-examples restore-keys: | - ${{ runner.os }}-examples-yarn- + go-${{ runner.os }}- - name: installing dependencies run: | yarn install --frozen-lockfile --prefer-offline @@ -72,8 +90,8 @@ jobs: run: yarn build env: TERRAFORM_BINARY_NAME: "terraform${{ matrix.terraform }}" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} - name: create bundle run: yarn package - name: examples integration tests @@ -83,5 +101,5 @@ jobs: TEST_TARGET: "${{ matrix.target }}" TERRAFORM_BINARY_NAME: "terraform${{ matrix.terraform }}" MAVEN_OPTS: "-Xmx3G" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c6a0085094..ef0e76f9b5 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -33,18 +33,28 @@ jobs: run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk - name: ensure correct user run: chown -R root /__w/terraform-cdk - - name: Get yarn cache directory path + # Setup caches for yarn, and go + - name: Get cache directory paths id: global-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-integration + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: - path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-integration-yarn-${{ hashFiles('**/yarn.lock') }} + path: ${{ steps.global-cache-dir-path.outputs.go }} + key: go-${{ runner.os }}-integration + restore-keys: | + go-${{ runner.os }}- - name: install dependencies run: yarn install --frozen-lockfile --prefer-offline - env: - YARN_CACHE_FOLDER: ${{ steps.global-cache-dir-path.outputs.dir }} - name: set version if: ${{ !inputs.skip_setup }} run: tools/align-version.sh "-dev.$GITHUB_RUN_ID" @@ -55,8 +65,7 @@ jobs: yarn package env: SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} - name: Upload dist uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce if: ${{ !inputs.skip_setup }} @@ -72,8 +81,6 @@ jobs: - name: installing test dependencies run: | cd test && yarn install --frozen-lockfile --prefer-offline - env: - YARN_CACHE_FOLDER: ${{ steps.global-cache-dir-path.outputs.dir }} - id: build-test-matrix run: | ./tools/build-test-matrix.sh @@ -95,16 +102,41 @@ jobs: steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - - name: Get yarn cache directory path - id: global-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: ensure correct user run: chown -R root /__w/terraform-cdk + # Setup caches for yarn, terraform, and go + - name: Get cache directory paths + id: global-cache-dir-path + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/terraform + echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: - path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-integration-yarn-${{ hashFiles('**/yarn.lock') }} + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + # put matrix before integration to not restore caches from other sibling matrix jobs + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-matrix-integration-${{ matrix.target }} + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-integration + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.terraform }} + # put matrix before integration to not restore caches from other sibling matrix jobs + key: terraform-${{ runner.os }}-${{ matrix.terraform }}-matrix-integration-${{ matrix.target }} + restore-keys: | + terraform-${{ runner.os }}-${{ matrix.terraform }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.go }} + # put matrix before integration to not restore caches from other sibling matrix jobs + key: go-${{ runner.os }}-matrix-integration-${{ matrix.target }} + restore-keys: | + go-${{ runner.os }}-integration + go-${{ runner.os }}- - name: Download dist uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a with: @@ -124,8 +156,8 @@ jobs: TERRAFORM_CLOUD_TOKEN: ${{ secrets.TERRAFORM_CLOUD_TOKEN }} TERRAFORM_BINARY_NAME: "terraform${{ matrix.terraform }}" NODE_OPTIONS: "--max-old-space-size=7168" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} windows_integration: needs: prepare-integration-tests @@ -143,15 +175,40 @@ jobs: steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - - name: Get yarn cache directory path + # Setup caches for yarn, terraform, and go + - name: Get cache directory paths id: global-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT shell: bash + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/terraform + echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + # put matrix before integration to not restore caches from other sibling matrix jobs + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-matrix-integration-${{ matrix.target }} + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-integration + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.terraform }} + # put matrix before integration to not restore caches from other sibling matrix jobs + key: terraform-${{ runner.os }}-${{ matrix.terraform }}-matrix-integration-${{ matrix.target }} + restore-keys: | + terraform-${{ runner.os }}-${{ matrix.terraform }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: - path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-integration-yarn-${{ hashFiles('**/yarn.lock') }} + path: ${{ steps.global-cache-dir-path.outputs.go }} + # put matrix before integration to not restore caches from other sibling matrix jobs + key: go-${{ runner.os }}-matrix-integration-${{ matrix.target }} + restore-keys: | + go-${{ runner.os }}-integration + go-${{ runner.os }}- - name: HashiCorp - Setup Terraform uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 with: @@ -185,5 +242,5 @@ jobs: TEST_TARGET: ${{ matrix.target }} TERRAFORM_CLOUD_TOKEN: ${{ secrets.TERRAFORM_CLOUD_TOKEN }} NODE_OPTIONS: "--max-old-space-size=7168" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} diff --git a/.github/workflows/provider-integration.yml b/.github/workflows/provider-integration.yml index e6d89bde31..fad1adba12 100644 --- a/.github/workflows/provider-integration.yml +++ b/.github/workflows/provider-integration.yml @@ -11,6 +11,11 @@ on: default: pr required: false type: string + terraform_version: + description: Version of Terraform to use + default: 1.2.8 + type: string + required: false concurrency: group: ${{ inputs.concurrency_group_prefix }}-provider-integration-${{ github.head_ref }} @@ -33,18 +38,26 @@ jobs: run: git config --global --add safe.directory /__w/terraform-cdk/terraform-cdk - name: ensure correct user run: chown -R root /__w/terraform-cdk - - name: Get yarn cache directory path + # Setup caches for yarn, and go + - name: Get cache directory paths id: global-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: - path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - name: ensure all plugin directories exist - run: | - mkdir -p ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - mkdir -p ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-provider-integration + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.go }} + key: go-${{ runner.os }}-provider-integration + restore-keys: | + go-${{ runner.os }}- - name: installing dependencies and build if: ${{ !inputs.skip_setup }} run: | @@ -53,9 +66,10 @@ jobs: yarn build yarn package env: - TERRAFORM_BINARY_NAME: "terraform${{ inputs.terraform_version }}" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} + - name: install test dependencies to warm up cache for matrix jobs to use + run: | + cd test && yarn - name: Upload dist if: ${{ !inputs.skip_setup }} uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce @@ -76,7 +90,8 @@ jobs: image: docker.mirror.hashicorp.services/hashicorp/jsii-terraform env: CHECKPOINT_DISABLE: "1" - TERRAFORM_VERSION: ${{ matrix.terraform }} + TERRAFORM_VERSION: ${{ inputs.terraform_version }} + TERRAFORM_BINARY_NAME: "terraform${{ inputs.terraform_version }}" timeout-minutes: 60 steps: @@ -88,6 +103,27 @@ jobs: path: dist - name: ensure correct user run: chown -R root /__w/terraform-cdk + - name: Get cache directory paths + id: global-cache-dir-path + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/terraform + echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT + # Only restoring yarn caches as the dependencies are not indiviual to each matrix job + - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-provider-integration + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.terraform }} + # put matrix before provider-integration to not restore caches from other sibling matrix jobs + key: terraform-${{ runner.os }}-${{ inputs.terraform_version }}-matrix-provider-integration-${{ matrix.target }} + restore-keys: | + terraform-${{ runner.os }}-${{ inputs.terraform_version }}- - name: install test dependencies run: cd test && yarn - name: integration tests @@ -95,8 +131,7 @@ jobs: env: TEST_TARGET: ${{ matrix.target }} NODE_OPTIONS: "--max-old-space-size=7168" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} windows_provider: needs: prepare-provider-tests @@ -106,7 +141,7 @@ jobs: matrix: ${{fromJSON(needs.prepare-provider-tests.outputs.tests)}} env: CHECKPOINT_DISABLE: "1" - TERRAFORM_VERSION: ${{ matrix.terraform }} + TERRAFORM_VERSION: ${{ inputs.terraform_version }} timeout-minutes: 60 steps: @@ -115,7 +150,7 @@ jobs: uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 with: terraform_wrapper: false - terraform_version: ${{ matrix.terraform }} + terraform_version: ${{ inputs.terraform_version }} - name: Install pipenv run: pip install pipenv - name: Install Go @@ -127,6 +162,28 @@ jobs: with: name: dist path: dist + - name: Get cache directory paths + id: global-cache-dir-path + shell: bash + run: | + echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/terraform + echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT + # Only restoring yarn caches to save available cache storage size + - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.yarn }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-provider-integration + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 + with: + path: ${{ steps.global-cache-dir-path.outputs.terraform }} + # put matrix before provider-integration to not restore caches from other sibling matrix jobs + key: terraform-${{ runner.os }}-${{ matrix.terraform }}-matrix-provider-integration-${{ matrix.target }} + restore-keys: | + terraform-${{ runner.os }}-${{ matrix.terraform }}- # tmp fix for https://github.com/npm/cli/issues/4980 - name: update npm run: npm install -g npm@8.12.1 @@ -137,5 +194,4 @@ jobs: env: TEST_TARGET: ${{ matrix.target }} NODE_OPTIONS: "--max-old-space-size=7168" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins - GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache + TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index ae34639d30..dc058a8c9a 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -41,25 +41,35 @@ jobs: id: global-cache-dir-path run: | echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT - echo "terraform=$(mktemp -d)" >> $GITHUB_OUTPUT - echo "go=$(mktemp -d)" >> $GITHUB_OUTPUT - echo "providerSchema=$(mktemp -d)" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/terraform + echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/go + echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT + mkdir -p /usr/local/share/.cache/providerSchema + echo "providerSchema=/usr/local/share/.cache/providerSchema" >> $GITHUB_OUTPUT - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.yarn }} - key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-unit + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.terraform }} - key: terraform-${{ runner.os }}-${{ inputs.terraform_version }} + key: terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit + restore-keys: | + terraform-${{ runner.os }}-${{ inputs.terraform_version }} - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} - key: go-${{ runner.os }} + key: go-${{ runner.os }}-unit + restore-keys: | + go-${{ runner.os }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.providerSchema }} - key: providerSchema-${{ runner.os }}-${{ inputs.terraform_version }} + key: providerSchema-${{ runner.os }}-${{ inputs.terraform_version }}-unit - name: installing dependencies run: | diff --git a/.github/workflows/yarn-upgrade.yml b/.github/workflows/yarn-upgrade.yml index 5db9f7800c..195d82a253 100644 --- a/.github/workflows/yarn-upgrade.yml +++ b/.github/workflows/yarn-upgrade.yml @@ -21,10 +21,12 @@ jobs: id: global-cache-dir-path run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.global-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-upgrade + restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- + yarn-${{ runner.os }}- - name: ensure correct user run: chown -R root /__w/terraform-cdk - name: Install Tools From 876a678340a584ffd2320e58bde8da7cfcda7ccc Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Fri, 29 Sep 2023 18:57:50 +0200 Subject: [PATCH 25/58] fix: use distinct caches for unit tests of different packages running in parallel --- .github/workflows/unit.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index dc058a8c9a..b8d333a0b5 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -50,15 +50,17 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.yarn }} - key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-unit + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-unit-${{ inputs.package }} restore-keys: | + yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-unit- yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- yarn-${{ runner.os }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.terraform }} - key: terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit + key: terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit-${{ inputs.package }} restore-keys: | + terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit terraform-${{ runner.os }}-${{ inputs.terraform_version }} - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: @@ -69,7 +71,7 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.providerSchema }} - key: providerSchema-${{ runner.os }}-${{ inputs.terraform_version }}-unit + key: providerSchema-${{ runner.os }}-${{ inputs.terraform_version }}-unit-${{ inputs.package }} - name: installing dependencies run: | From 72015bbd485694f616846f52b8bab77dd09525f6 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Fri, 29 Sep 2023 19:11:05 +0200 Subject: [PATCH 26/58] fix - don't use restore-keys for tf cache for unit tests --- .github/workflows/unit.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index b8d333a0b5..8e81cb547c 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -59,9 +59,8 @@ jobs: with: path: ${{ steps.global-cache-dir-path.outputs.terraform }} key: terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit-${{ inputs.package }} - restore-keys: | - terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit - terraform-${{ runner.os }}-${{ inputs.terraform_version }} + # Note: we are not using restore-keys here as they cause unit tests to fail with Terraform checksum errors + # coming from restored sibling caches somehow - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} From 8bc0e9cafad4860089423209462abe4cefc36611 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Mon, 2 Oct 2023 10:14:11 +0200 Subject: [PATCH 27/58] feat: include hash of go.sum in go cache key --- .github/workflows/build.yml | 3 ++- .github/workflows/examples.yml | 3 ++- .github/workflows/integration.yml | 13 ++++++++----- .github/workflows/provider-integration.yml | 3 ++- .github/workflows/unit.yml | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a3c07c383..7fde1e2fcb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,8 +44,9 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} - key: go-${{ runner.os }}-build + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-build restore-keys: | + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}- go-${{ runner.os }}- - name: install dependencies run: yarn install diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 5fbdeb5639..d4268b0b4b 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -75,8 +75,9 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} - key: go-${{ runner.os }}-examples + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-examples restore-keys: | + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}- go-${{ runner.os }}- - name: installing dependencies run: | diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ef0e76f9b5..304ea1dd94 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -50,8 +50,9 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} - key: go-${{ runner.os }}-integration + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-integration restore-keys: | + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}- go-${{ runner.os }}- - name: install dependencies run: yarn install --frozen-lockfile --prefer-offline @@ -133,9 +134,10 @@ jobs: with: path: ${{ steps.global-cache-dir-path.outputs.go }} # put matrix before integration to not restore caches from other sibling matrix jobs - key: go-${{ runner.os }}-matrix-integration-${{ matrix.target }} + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-matrix-integration-${{ matrix.target }} restore-keys: | - go-${{ runner.os }}-integration + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-integration + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }} go-${{ runner.os }}- - name: Download dist uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a @@ -205,9 +207,10 @@ jobs: with: path: ${{ steps.global-cache-dir-path.outputs.go }} # put matrix before integration to not restore caches from other sibling matrix jobs - key: go-${{ runner.os }}-matrix-integration-${{ matrix.target }} + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-matrix-integration-${{ matrix.target }} restore-keys: | - go-${{ runner.os }}-integration + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-integration + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}- go-${{ runner.os }}- - name: HashiCorp - Setup Terraform uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 diff --git a/.github/workflows/provider-integration.yml b/.github/workflows/provider-integration.yml index fad1adba12..8000a53e64 100644 --- a/.github/workflows/provider-integration.yml +++ b/.github/workflows/provider-integration.yml @@ -55,8 +55,9 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} - key: go-${{ runner.os }}-provider-integration + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-provider-integration restore-keys: | + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}- go-${{ runner.os }}- - name: installing dependencies and build if: ${{ !inputs.skip_setup }} diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 8e81cb547c..9e85c33d84 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -64,8 +64,9 @@ jobs: - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} - key: go-${{ runner.os }}-unit + key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-unit restore-keys: | + go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}- go-${{ runner.os }}- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: From 422d01b6b16c17acdd2e024a19f333609eb0818b Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Mon, 2 Oct 2023 10:33:37 +0200 Subject: [PATCH 28/58] fix: don't cache terraform for unit tests as that fails with checksum errors upon cache restore --- .github/workflows/unit.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 9e85c33d84..2b09e72f14 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -41,8 +41,6 @@ jobs: id: global-cache-dir-path run: | echo "yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT - mkdir -p /usr/local/share/.cache/terraform - echo "terraform=/usr/local/share/.cache/terraform" >> $GITHUB_OUTPUT mkdir -p /usr/local/share/.cache/go echo "go=/usr/local/share/.cache/go" >> $GITHUB_OUTPUT mkdir -p /usr/local/share/.cache/providerSchema @@ -55,12 +53,6 @@ jobs: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-unit- yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}- yarn-${{ runner.os }}- - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - with: - path: ${{ steps.global-cache-dir-path.outputs.terraform }} - key: terraform-${{ runner.os }}-${{ inputs.terraform_version }}-unit-${{ inputs.package }} - # Note: we are not using restore-keys here as they cause unit tests to fail with Terraform checksum errors - # coming from restored sibling caches somehow - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: ${{ steps.global-cache-dir-path.outputs.go }} From a496b0dda17b382bd3a82433ec642c4cb96fa8aa Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Mon, 2 Oct 2023 11:08:05 +0200 Subject: [PATCH 29/58] fix - unset TF_PLUGIN_CACHE_DIR to fix TF checksum errors --- .github/workflows/unit.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 2b09e72f14..5b5970c0e4 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -75,13 +75,12 @@ jobs: yarn package env: TERRAFORM_BINARY_NAME: "terraform${{ inputs.terraform_version }}" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} - name: test run: | + unset TF_PLUGIN_CACHE_DIR npx lerna run --scope '${{ inputs.package }}' test:ci env: TERRAFORM_BINARY_NAME: "terraform${{ inputs.terraform_version }}" - TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.terraform }} GOCACHE: ${{ steps.global-cache-dir-path.outputs.go }} CDKTF_EXPERIMENTAL_PROVIDER_SCHEMA_CACHE_PATH: ${{ steps.global-cache-dir-path.outputs.providerSchema }} From 6d8bbb854df6a83be38a415e20f64071ae03185d Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Mon, 2 Oct 2023 15:00:12 +0200 Subject: [PATCH 30/58] fix(hcl2cdk): Try to fix TF checksum errors in tests by running them in band --- packages/@cdktf/hcl2cdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@cdktf/hcl2cdk/package.json b/packages/@cdktf/hcl2cdk/package.json index 24db08c335..a79b3b53b7 100644 --- a/packages/@cdktf/hcl2cdk/package.json +++ b/packages/@cdktf/hcl2cdk/package.json @@ -12,7 +12,7 @@ "watch": "tsc -w", "watch-preserve-output": "tsc -w --preserveWatchOutput", "test": "jest", - "test:ci": "jest --ci", + "test:ci": "jest --ci --runInBand", "jest-watch": "jest --watch", "package": "./package.sh", "dist-clean": "rm -rf dist" From 30cde214c105be2da476dad80d7390a5ee0cea6c Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Wed, 4 Oct 2023 11:54:49 +0200 Subject: [PATCH 31/58] chore(release): Release 0.18.1 --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c530efa882..7fb7c41111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ +## 0.18.1 + +### fix + +- fix(docs): Fix typo in example of using TF*VAR* to set TerraformVariable [\#3116](https://github.com/hashicorp/terraform-cdk/pull/3116) +- fix(provider-generator): make sanitize comments function robust against diverse inputs [\#3131](https://github.com/hashicorp/terraform-cdk/pull/3131) +- fix(cli): fix help template spelling [\#3146](https://github.com/hashicorp/terraform-cdk/pull/3146) +- fix(cli): ensure terraform output fails with a proper error [\#3135](https://github.com/hashicorp/terraform-cdk/pull/3135) +- fix: make sure noColor option is honored [\#3138](https://github.com/hashicorp/terraform-cdk/pull/3138) +- fix(hcl2cdk): Try to fix TF checksum errors in tests by running them in band [\#3163](https://github.com/hashicorp/terraform-cdk/pull/3163) +- fix: use whl to install local python [\#3119](https://github.com/hashicorp/terraform-cdk/pull/3119) +- fix: fix Github workflow caches to restore successfully more often [\#3154](https://github.com/hashicorp/terraform-cdk/pull/3154) +- fix: set specific copywrite tool version to fix CI [\#3150](https://github.com/hashicorp/terraform-cdk/pull/3150) +- fix: unpin version of copywrite [\#3151](https://github.com/hashicorp/terraform-cdk/pull/3151) + +### chore + +- chore: Upgrade docker image to use Node 18 [\#3107](https://github.com/hashicorp/terraform-cdk/pull/3107) +- chore: fix passing additional providers [\#3092](https://github.com/hashicorp/terraform-cdk/pull/3092) +- chore(docs): fix grammar and spelling on Performance page [\#3098](https://github.com/hashicorp/terraform-cdk/pull/3098) +- chore: fix typo [\#3091](https://github.com/hashicorp/terraform-cdk/pull/3091) +- chore(cli): fixes typo (#3120) [\#3121](https://github.com/hashicorp/terraform-cdk/pull/3121) +- chore: fix typo in registry workflow [\#3100](https://github.com/hashicorp/terraform-cdk/pull/3100) +- chore: fix remove-waiting-on-answer workflow [\#3097](https://github.com/hashicorp/terraform-cdk/pull/3097) +- chore: ensure GitHub treats us as a TypeScript project [\#3099](https://github.com/hashicorp/terraform-cdk/pull/3099) +- chore: update registry tool [\#3101](https://github.com/hashicorp/terraform-cdk/pull/3101) +- chore: update dependencies for @cdktf/commons [\#3096](https://github.com/hashicorp/terraform-cdk/pull/3096) +- chore: update cdktf version [\#3090](https://github.com/hashicorp/terraform-cdk/pull/3090) +- chore: remove obsolete comment [\#3137](https://github.com/hashicorp/terraform-cdk/pull/3137) + +### refactor + +- refactor: move schema reading logic into package [\#3124](https://github.com/hashicorp/terraform-cdk/pull/3124) + ## 0.18.0 ### chore diff --git a/package.json b/package.json index 57222f6dce..50a1b203ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "root", - "version": "0.18.0", + "version": "0.18.1", "private": true, "scripts": { "build-and-package": "lerna run --scope 'cdktf*' --scope @cdktf/* build,package && tools/collect-dist.sh", From b19a0d8d5bf5bd9cf93674ccdb39ab9a533369f7 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 5 Oct 2023 11:04:54 +0200 Subject: [PATCH 32/58] fix: Fix partial dependency update for Sentry --- packages/@cdktf/cli-core/package.json | 2 +- .../cli-core/src/lib/error-reporting.ts | 5 +- packages/cdktf-cli/package.json | 2 +- yarn.lock | 58 +------------------ 4 files changed, 6 insertions(+), 61 deletions(-) diff --git a/packages/@cdktf/cli-core/package.json b/packages/@cdktf/cli-core/package.json index 6e186872d1..ffbb32d428 100644 --- a/packages/@cdktf/cli-core/package.json +++ b/packages/@cdktf/cli-core/package.json @@ -42,7 +42,7 @@ "@cdktf/hcl2json": "0.0.0", "@cdktf/provider-schema": "0.0.0", "@cdktf/node-pty-prebuilt-multiarch": "0.10.1-pre.10", - "@sentry/node": "^6.19.7", + "@sentry/node": "^7.64.0", "archiver": "^5.3.1", "cdktf": "0.0.0", "chalk": "^4.1.2", diff --git a/packages/@cdktf/cli-core/src/lib/error-reporting.ts b/packages/@cdktf/cli-core/src/lib/error-reporting.ts index f51cd54e0e..f8f84c6a3a 100644 --- a/packages/@cdktf/cli-core/src/lib/error-reporting.ts +++ b/packages/@cdktf/cli-core/src/lib/error-reporting.ts @@ -96,8 +96,9 @@ export async function initializErrorReporting( | Error | string | null - | undefined = hint.originalException; - let error: Error | string | null | undefined; + | undefined + | unknown = hint.originalException; + let error: Error | string | null | undefined | unknown; if (isPromise(originalException)) { (originalException as unknown as Promise).catch( (e) => (error = e) diff --git a/packages/cdktf-cli/package.json b/packages/cdktf-cli/package.json index cb4cbeb722..97fbe7b4ab 100644 --- a/packages/cdktf-cli/package.json +++ b/packages/cdktf-cli/package.json @@ -43,7 +43,7 @@ "@cdktf/hcl2cdk": "0.0.0", "@cdktf/hcl2json": "0.0.0", "@inquirer/prompts": "^2.3.0", - "@sentry/node": "^6.19.7", + "@sentry/node": "^7.64.0", "cdktf": "0.0.0", "ci-info": "^3.8.0", "codemaker": "^1.87.0", diff --git a/yarn.lock b/yarn.lock index 2278136280..e77ba75f61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1945,17 +1945,6 @@ "@sentry/utils" "7.64.0" tslib "^2.4.1 || ^1.9.3" -"@sentry/core@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.7.tgz#156aaa56dd7fad8c89c145be6ad7a4f7209f9785" - integrity sha512-tOfZ/umqB2AcHPGbIrsFLcvApdTm9ggpi/kQZFkej7kMphjT+SGBiQfYtjyg9jcRW+ilAR4JXC9BGKsdEQ+8Vw== - dependencies: - "@sentry/hub" "6.19.7" - "@sentry/minimal" "6.19.7" - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - tslib "^1.9.3" - "@sentry/core@7.64.0": version "7.64.0" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.64.0.tgz#9d61cdc29ba299dedbdcbe01cfadf94bd0b7df48" @@ -1965,38 +1954,6 @@ "@sentry/utils" "7.64.0" tslib "^2.4.1 || ^1.9.3" -"@sentry/hub@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.7.tgz#58ad7776bbd31e9596a8ec46365b45cd8b9cfd11" - integrity sha512-y3OtbYFAqKHCWezF0EGGr5lcyI2KbaXW2Ik7Xp8Mu9TxbSTuwTe4rTntwg8ngPjUQU3SUHzgjqVB8qjiGqFXCA== - dependencies: - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - tslib "^1.9.3" - -"@sentry/minimal@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.7.tgz#b3ee46d6abef9ef3dd4837ebcb6bdfd01b9aa7b4" - integrity sha512-wcYmSJOdvk6VAPx8IcmZgN08XTXRwRtB1aOLZm+MVHjIZIhHoBGZJYTVQS/BWjldsamj2cX3YGbGXNunaCfYJQ== - dependencies: - "@sentry/hub" "6.19.7" - "@sentry/types" "6.19.7" - tslib "^1.9.3" - -"@sentry/node@^6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.19.7.tgz#32963b36b48daebbd559e6f13b1deb2415448592" - integrity sha512-gtmRC4dAXKODMpHXKfrkfvyBL3cI8y64vEi3fDD046uqYcrWdgoQsffuBbxMAizc6Ez1ia+f0Flue6p15Qaltg== - dependencies: - "@sentry/core" "6.19.7" - "@sentry/hub" "6.19.7" - "@sentry/types" "6.19.7" - "@sentry/utils" "6.19.7" - cookie "^0.4.1" - https-proxy-agent "^5.0.0" - lru_map "^0.3.3" - tslib "^1.9.3" - "@sentry/node@^7.64.0": version "7.64.0" resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.64.0.tgz#c6f7a67c1442324298f0525e7191bc18572ee1ce" @@ -2011,24 +1968,11 @@ lru_map "^0.3.3" tslib "^2.4.1 || ^1.9.3" -"@sentry/types@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.7.tgz#c6b337912e588083fc2896eb012526cf7cfec7c7" - integrity sha512-jH84pDYE+hHIbVnab3Hr+ZXr1v8QABfhx39KknxqKWr2l0oEItzepV0URvbEhB446lk/S/59230dlUUIBGsXbg== - "@sentry/types@7.64.0": version "7.64.0" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.64.0.tgz#21fc545ea05c3c8c4c3e518583eca1a8c5429506" integrity sha512-LqjQprWXjUFRmzIlUjyA+KL+38elgIYmAeoDrdyNVh8MK5IC1W2Lh1Q87b4yOiZeMiIhIVNBd7Ecoh2rodGrGA== -"@sentry/utils@6.19.7": - version "6.19.7" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.7.tgz#6edd739f8185fd71afe49cbe351c1bbf5e7b7c79" - integrity sha512-z95ECmE3i9pbWoXQrD/7PgkBAzJYR+iXtPuTkpBjDKs86O3mT+PXOT3BAn79w2wkn7/i3vOGD2xVr1uiMl26dA== - dependencies: - "@sentry/types" "6.19.7" - tslib "^1.9.3" - "@sentry/utils@7.64.0": version "7.64.0" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.64.0.tgz#6fe3ce9a56d3433ed32119f914907361a54cc184" @@ -11583,7 +11527,7 @@ tsconfig-paths@^4.1.2: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.8.1, tslib@^1.9.3: +tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== From 60c27c2b17d9f7f6225b9033f3d5dbaa790f89d4 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 5 Oct 2023 11:23:49 +0200 Subject: [PATCH 33/58] chore(release): Update CHANGELOG.md and version to 0.18.2 (#3173) ## 0.18.2 Fixes a bug in 0.18.1 that broke crash reporting due to a partial dependency upgrade. ### fix - fix: Fix partial dependency update for Sentry [\#3172](https://github.com/hashicorp/terraform-cdk/pull/3172) --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fb7c41111..837c94d866 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.18.2 + +Fixes a bug in 0.18.1 that broke crash reporting due to a partial dependency upgrade. + +### fix + +- fix: Fix partial dependency update for Sentry [\#3172](https://github.com/hashicorp/terraform-cdk/pull/3172) + ## 0.18.1 ### fix diff --git a/package.json b/package.json index 50a1b203ff..5884141a08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "root", - "version": "0.18.1", + "version": "0.18.2", "private": true, "scripts": { "build-and-package": "lerna run --scope 'cdktf*' --scope @cdktf/* build,package && tools/collect-dist.sh", From c1f1cfc81bddcf48148846de15f54d3a97f3fbce Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 28 Jun 2023 16:19:01 +0200 Subject: [PATCH 34/58] feat: add import capabilities to cdktf --- examples/typescript/aws-import/.gitignore | 11 +++ .../aws-import/__tests__/main-test.ts | 87 +++++++++++++++++++ examples/typescript/aws-import/cdktf.json | 7 ++ examples/typescript/aws-import/help | 34 ++++++++ examples/typescript/aws-import/jest.config.js | 16 ++++ examples/typescript/aws-import/main.ts | 27 ++++++ examples/typescript/aws-import/package.json | 30 +++++++ examples/typescript/aws-import/setup.js | 7 ++ packages/cdktf/lib/terraform-resource.ts | 39 +++++++-- 9 files changed, 251 insertions(+), 7 deletions(-) create mode 100644 examples/typescript/aws-import/.gitignore create mode 100644 examples/typescript/aws-import/__tests__/main-test.ts create mode 100644 examples/typescript/aws-import/cdktf.json create mode 100644 examples/typescript/aws-import/help create mode 100644 examples/typescript/aws-import/jest.config.js create mode 100644 examples/typescript/aws-import/main.ts create mode 100644 examples/typescript/aws-import/package.json create mode 100644 examples/typescript/aws-import/setup.js diff --git a/examples/typescript/aws-import/.gitignore b/examples/typescript/aws-import/.gitignore new file mode 100644 index 0000000000..1dfae30c78 --- /dev/null +++ b/examples/typescript/aws-import/.gitignore @@ -0,0 +1,11 @@ +*.d.ts +*.js +node_modules +cdktf.out +cdktf.log +*terraform.*.tfstate* +.gen +.terraform +tsconfig.tsbuildinfo +!jest.config.js +!setup.js \ No newline at end of file diff --git a/examples/typescript/aws-import/__tests__/main-test.ts b/examples/typescript/aws-import/__tests__/main-test.ts new file mode 100644 index 0000000000..4f4cd20106 --- /dev/null +++ b/examples/typescript/aws-import/__tests__/main-test.ts @@ -0,0 +1,87 @@ +// Copyright (c) HashiCorp, Inc +// SPDX-License-Identifier: MPL-2.0 +// import { Testing } from "cdktf"; +// import "cdktf/lib/testing/adapters/jest"; + +describe("My CDKTF Application", () => { + it.todo("should be tested"); + + // // All Unit testst test the synthesised terraform code, it does not create real-world resources + // describe("Unit testing using assertions", () => { + // it("should contain a resource", () => { + // // import { Image,Container } from "./.gen/providers/docker" + // expect( + // Testing.synthScope((scope) => { + // new MyApplicationsAbstraction(scope, "my-app", {}); + // }) + // ).toHaveResource(Container); + + // expect( + // Testing.synthScope((scope) => { + // new MyApplicationsAbstraction(scope, "my-app", {}); + // }) + // ).toHaveResourceWithProperties(Image, { name: "ubuntu:latest" }); + // }); + // }); + + // describe("Unit testing using snapshots", () => { + // it("Tests the snapshot", () => { + // const app = Testing.app(); + // const stack = new TerraformStack(app, "test"); + + // new TestProvider(stack, "provider", { + // accessKey: "1", + // }); + + // new TestResource(stack, "test", { + // name: "my-resource", + // }); + + // expect(Testing.synth(stack)).toMatchSnapshot(); + // }); + + // it("Tests a combination of resources", () => { + // expect( + // Testing.synthScope((stack) => { + // new TestDataSource(stack, "test-data-source", { + // name: "foo", + // }); + + // new TestResource(stack, "test-resource", { + // name: "bar", + // }); + // }) + // ).toMatchInlineSnapshot(); + // }); + // }); + + // describe("Checking validity", () => { + // it("check if the produced terraform configuration is valid", () => { + // const app = Testing.app(); + // const stack = new TerraformStack(app, "test"); + + // new TestDataSource(stack, "test-data-source", { + // name: "foo", + // }); + + // new TestResource(stack, "test-resource", { + // name: "bar", + // }); + // expect(Testing.fullSynth(app)).toBeValidTerraform(); + // }); + + // it("check if this can be planned", () => { + // const app = Testing.app(); + // const stack = new TerraformStack(app, "test"); + + // new TestDataSource(stack, "test-data-source", { + // name: "foo", + // }); + + // new TestResource(stack, "test-resource", { + // name: "bar", + // }); + // expect(Testing.fullSynth(app)).toPlanSuccessfully(); + // }); + // }); +}); diff --git a/examples/typescript/aws-import/cdktf.json b/examples/typescript/aws-import/cdktf.json new file mode 100644 index 0000000000..3ec54a79c2 --- /dev/null +++ b/examples/typescript/aws-import/cdktf.json @@ -0,0 +1,7 @@ +{ + "language": "typescript", + "app": "npx ts-node main.ts", + "terraformProviders": [ + "aws@~> 5.0" + ] +} \ No newline at end of file diff --git a/examples/typescript/aws-import/help b/examples/typescript/aws-import/help new file mode 100644 index 0000000000..83a74dd683 --- /dev/null +++ b/examples/typescript/aws-import/help @@ -0,0 +1,34 @@ +======================================================================================================== + + Your cdktf typescript project is ready! + + cat help Print this message + + Compile: + npm run compile Compile typescript code to javascript (or "yarn watch") + npm run watch Watch for changes and compile typescript in the background + npm run build cdktf get and compile typescript + + Synthesize: + cdktf synth Synthesize Terraform resources from stacks to cdktf.out/ (ready for 'terraform apply') + + Diff: + cdktf diff Perform a diff (terraform plan) for the given stack + + Deploy: + cdktf deploy Deploy the given stack + + Destroy: + cdktf destroy Destroy the stack + + Test: + npm run test Runs unit tests (edit __tests__/main-test.ts to add your own tests) + npm run test:watch Watches the tests and reruns them on change + + + Upgrades: + npm run get Import/update Terraform providers and modules (you should check-in this directory) + npm run upgrade Upgrade cdktf modules to latest version + npm run upgrade:next Upgrade cdktf modules to latest "@next" version (last commit) + +======================================================================================================== diff --git a/examples/typescript/aws-import/jest.config.js b/examples/typescript/aws-import/jest.config.js new file mode 100644 index 0000000000..e53ea43b7d --- /dev/null +++ b/examples/typescript/aws-import/jest.config.js @@ -0,0 +1,16 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + +/* + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration + */ + +module.exports = { + clearMocks: true, + coverageProvider: "v8", + setupFilesAfterEnv: ["./setup.js"], + }; + diff --git a/examples/typescript/aws-import/main.ts b/examples/typescript/aws-import/main.ts new file mode 100644 index 0000000000..556321c1b2 --- /dev/null +++ b/examples/typescript/aws-import/main.ts @@ -0,0 +1,27 @@ +// Copyright (c) HashiCorp, Inc +// SPDX-License-Identifier: MPL-2.0 +import { Construct } from "constructs"; +import { App, TerraformStack } from "cdktf"; +import { AwsProvider } from "./.gen/providers/aws/provider"; +import { S3Bucket } from "./.gen/providers/aws/s3-bucket"; + +class MyStack extends TerraformStack { + constructor(scope: Construct, ns: string) { + super(scope, ns); + + // Step 1: Create a S3Bucket in the AWS web ui + // https://s3.console.aws.amazon.com/s3/buckets?region=us-east-1®ion=us-east-1 + + new AwsProvider(this, "aws", { + region: "us-east-1", + }); + + // Step 2: Create importable resource + const bucketId = "best-bucket-in-the-world"; + new S3Bucket(this, "bucket", {}).importFrom(bucketId); + } +} + +const app = new App(); +new MyStack(app, "typescript-aws-cloudfront-proxy"); +app.synth(); diff --git a/examples/typescript/aws-import/package.json b/examples/typescript/aws-import/package.json new file mode 100644 index 0000000000..810364fda9 --- /dev/null +++ b/examples/typescript/aws-import/package.json @@ -0,0 +1,30 @@ +{ + "name": "@examples/typescript-aws-import", + "version": "0.0.0", + "main": "main.js", + "types": "main.ts", + "license": "MPL-2.0", + "scripts": { + "get": "cdktf get", + "build": "yarn get && tsc", + "synth": "cdktf synth", + "compile": "tsc --pretty", + "watch": "tsc -w", + "test": "jest", + "test:watch": "jest --watch", + "upgrade": "npm i cdktf@latest cdktf-cli@latest", + "upgrade:next": "npm i cdktf@next cdktf-cli@next" + }, + "dependencies": { + "cdktf": "0.0.0", + "constructs": "^10.0.25" + }, + "devDependencies": { + "@types/jest": "27.5.2", + "@types/node": "16.18.23", + "cdktf-cli": "0.0.0", + "jest": "^27.5.1", + "ts-node": "^10.9.1", + "typescript": "^5.0.2" + } +} diff --git a/examples/typescript/aws-import/setup.js b/examples/typescript/aws-import/setup.js new file mode 100644 index 0000000000..cabf53825f --- /dev/null +++ b/examples/typescript/aws-import/setup.js @@ -0,0 +1,7 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + +const cdktf = require("cdktf"); +cdktf.Testing.setupJest(); diff --git a/packages/cdktf/lib/terraform-resource.ts b/packages/cdktf/lib/terraform-resource.ts index a73864a034..b348417cf8 100644 --- a/packages/cdktf/lib/terraform-resource.ts +++ b/packages/cdktf/lib/terraform-resource.ts @@ -71,6 +71,11 @@ export interface TerraformResourceConfig extends TerraformMetaArguments { readonly terraformGeneratorMetadata?: TerraformProviderGeneratorMetadata; } +export interface TerraformResourceImport { + readonly id: string; + readonly provider?: TerraformProvider; +} + // eslint-disable-next-line jsdoc/require-jsdoc export class TerraformResource extends TerraformElement @@ -90,6 +95,7 @@ export class TerraformResource public provisioners?: Array< FileProvisioner | LocalExecProvisioner | RemoteExecProvisioner >; + public imported?: TerraformResourceImport; constructor(scope: Construct, id: string, config: TerraformResourceConfig) { super(scope, id, config.terraformResourceType); @@ -203,6 +209,15 @@ export class TerraformResource }; return { + import: this.imported + ? [ + { + provider: this.imported.provider, + id: this.imported.id, + to: `${this.terraformResourceType}.${this.friendlyUniqueId}`, + }, + ] + : undefined, resource: { [this.terraformResourceType]: { [this.friendlyUniqueId]: attributes, @@ -212,14 +227,17 @@ export class TerraformResource } public toMetadata(): any { - if (!Object.keys(this.rawOverrides).length) { - return {}; - } - return { - overrides: { - [this.terraformResourceType]: Object.keys(this.rawOverrides), - }, + overrides: Object.keys(this.rawOverrides).length + ? { + [this.terraformResourceType]: Object.keys(this.rawOverrides), + } + : undefined, + imports: this.imported + ? { + [this.terraformResourceType]: [this.friendlyUniqueId], + } + : undefined, }; } @@ -231,4 +249,11 @@ export class TerraformResource this.cdktfStack ); } + + public importFrom(id: string, provider?: TerraformProvider) { + this.imported = { id, provider }; + } + public resetImport() { + this.imported = undefined; + } } From 2c6435381fed991be37b227970b4893e263a40ce Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 28 Jun 2023 14:18:51 +0200 Subject: [PATCH 35/58] feat: support imports with config generation --- examples/typescript/aws-import/main.ts | 33 ++++++++++-- .../@cdktf/cli-core/src/lib/cdktf-stack.ts | 51 ++++++++++++++++++- packages/@cdktf/cli-core/src/lib/convert.ts | 30 +++++++++++ .../cli-core/src/lib/models/terraform-cli.ts | 26 +++++++++- .../get/generator/emitter/resource-emitter.ts | 11 ++++ packages/cdktf/lib/importable-resource.ts | 42 +++++++++++++++ packages/cdktf/lib/index.ts | 1 + 7 files changed, 189 insertions(+), 5 deletions(-) create mode 100644 packages/@cdktf/cli-core/src/lib/convert.ts create mode 100644 packages/cdktf/lib/importable-resource.ts diff --git a/examples/typescript/aws-import/main.ts b/examples/typescript/aws-import/main.ts index 556321c1b2..30265d5cc5 100644 --- a/examples/typescript/aws-import/main.ts +++ b/examples/typescript/aws-import/main.ts @@ -5,10 +5,11 @@ import { App, TerraformStack } from "cdktf"; import { AwsProvider } from "./.gen/providers/aws/provider"; import { S3Bucket } from "./.gen/providers/aws/s3-bucket"; -class MyStack extends TerraformStack { +class StackWithImport extends TerraformStack { constructor(scope: Construct, ns: string) { super(scope, ns); + const bucketId = "best-bucket-in-the-world"; // Step 1: Create a S3Bucket in the AWS web ui // https://s3.console.aws.amazon.com/s3/buckets?region=us-east-1®ion=us-east-1 @@ -17,11 +18,37 @@ class MyStack extends TerraformStack { }); // Step 2: Create importable resource - const bucketId = "best-bucket-in-the-world"; new S3Bucket(this, "bucket", {}).importFrom(bucketId); + + // Step 3: Run `cdktf apply` + // Step 4: Remove the `importFrom` call, the resource is now imported + } +} + +class StackWithImportAndConfigurationGeneration extends TerraformStack { + constructor(scope: Construct, ns: string) { + super(scope, ns); + + const bucketId = "best-bucket-in-the-world"; + // Step 1: Create a S3Bucket in the AWS web ui + // https://s3.console.aws.amazon.com/s3/buckets?region=us-east-1®ion=us-east-1 + + new AwsProvider(this, "aws", { + region: "us-east-1", + }); + + // Step 2: Create import block + S3Bucket.import(this, "bucket", bucketId); + + // Step 3: Run `cdktf plan` and get the configuration to put in below + // Step 4: Remove the `import` call, the resource is now imported } } const app = new App(); -new MyStack(app, "typescript-aws-cloudfront-proxy"); +new StackWithImport(app, "ts-import"); +new StackWithImportAndConfigurationGeneration( + app, + "ts-import-with-configuration" +); app.synth(); diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts b/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts index 18eb9b8422..38ea7b90b7 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts @@ -5,10 +5,15 @@ import { Terraform } from "./models/terraform"; import { getConstructIdsForOutputs, NestedTerraformOutputs } from "./output"; import { logger } from "@cdktf/commons"; import { extractJsonLogIfPresent } from "./server/terraform-logs"; -import { TerraformCli, OutputFilter } from "./models/terraform-cli"; +import { + TerraformCli, + OutputFilter, + findGeneratedConfigurationFile, +} from "./models/terraform-cli"; import { ProviderConstraint } from "./dependencies/dependency-manager"; import { terraformJsonSchema, TerraformStack } from "./terraform-json"; import { TerraformProviderLock } from "./terraform-provider-lock"; +import { convertConfigurationFile } from "./convert"; export type StackUpdate = | { @@ -61,6 +66,16 @@ export type StackUpdate = | { type: "dismissed"; stackName: string; + } + | { + type: "import with configuration detected"; + stackName: string; + configuration: string; + } + | { + type: "import with configuration converted"; + stackName: string; + configuration: string; }; export type StackUserInputUpdate = @@ -362,6 +377,40 @@ export class CdktfStack { noColor, }); this.updateState({ type: "planned", stackName: this.stack.name }); + + // Find generated file + const configFile = await findGeneratedConfigurationFile( + this.stack.workingDirectory + ); + if (configFile) { + this.updateState({ + type: "import with configuration detected", + stackName: this.stack.name, + configuration: configFile, + }); + + const convertedCode = await convertConfigurationFile(configFile); + this.updateState({ + type: "import with configuration converted", + stackName: this.stack.name, + configuration: convertedCode, + }); + const onLog = this.options.onLog; + if (onLog) { + onLog({ + message: `Import without configuration detected. Terraform has created configuration for it: +${configFile} + +CDKTF has translated the code to the following: + +${convertedCode} + +Please review the code and make any necessary changes before adding it to your codebase. +Make sure to only copy the code within the construct's constructor.`, + isError: false, + }); + } + } }); } diff --git a/packages/@cdktf/cli-core/src/lib/convert.ts b/packages/@cdktf/cli-core/src/lib/convert.ts new file mode 100644 index 0000000000..293843b7cf --- /dev/null +++ b/packages/@cdktf/cli-core/src/lib/convert.ts @@ -0,0 +1,30 @@ +import * as hcl2cdk from "@cdktf/hcl2cdk"; +import { CdktfConfig } from "./cdktf-config"; +import { + ConstructsMakerProviderTarget, + TerraformProviderConstraint, + readSchema, +} from "@cdktf/provider-generator"; +import { Errors, LANGUAGES } from "@cdktf/commons"; + +export async function convertConfigurationFile(configuration: string) { + const cfg = CdktfConfig.read(process.cwd()); // TODO: make this the project directory instead of cwd + const targets = cfg.terraformProviders.map((constraint) => + ConstructsMakerProviderTarget.from( + new TerraformProviderConstraint(constraint), + LANGUAGES[0] + ) + ); + const { providerSchema } = await readSchema(targets); + if (!providerSchema) { + throw Errors.Internal("Could not fetch provider schema"); + } + + const { all } = await hcl2cdk.convert(configuration, { + providerSchema, + language: cfg.language, + codeContainer: "constructs.Construct", + }); + + return all; +} diff --git a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts index 7d4f551430..0d2c4aca82 100644 --- a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts +++ b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts @@ -26,6 +26,8 @@ import { waitFor } from "xstate/lib/waitFor"; import { missingVariable } from "../errors"; import { terraformJsonSchema } from "../terraform-json"; import { spawnPty } from "./pty-process"; +import path from "path"; +import * as fs from "fs-extra"; export class TerraformCliPlan extends AbstractTerraformPlan @@ -214,7 +216,19 @@ export class TerraformCli implements Terraform { varFiles = [], noColor = false, } = opts; - const options = ["plan", "-input=false"]; + const options = [ + "plan", + "-input=false", + "-generate-config-out=generated_resources.tf", + ]; + + const generatedConfigFile = path.join( + this.workdir, + "generated_resources.tf" + ); + if (fs.existsSync(generatedConfigFile)) { + fs.remove(generatedConfigFile); + } if (!this.isCloudStack) { const planFile = "plan"; @@ -464,3 +478,13 @@ export class TerraformCli implements Terraform { return; } } + +export async function findGeneratedConfigurationFile( + workingDir: string +): Promise { + const generatedConfigPath = path.join(workingDir, "generated_resources.tf"); + if (!fs.existsSync(generatedConfigPath)) { + return null; + } + return fs.readFileSync(generatedConfigPath, "utf-8"); +} diff --git a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts index dc2be94a66..ca39b9f8ee 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts @@ -26,6 +26,9 @@ export class ResourceEmitter { this.emitHeader("STATIC PROPERTIES"); this.emitStaticProperties(resource); + this.emitHeader("STATIC Methods"); + this.emitStaticMethods(resource); + this.emitHeader("INITIALIZER"); this.emitInitializer(resource); @@ -52,6 +55,14 @@ export class ResourceEmitter { ); } + private emitStaticMethods(resource: ResourceModel) { + this.code.line( + `public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${resource.terraformResourceType}", importId: id, provider }); + }` + ); + } + private emitResourceSynthesis(resource: ResourceModel) { this.code.line(); this.code.openBlock( diff --git a/packages/cdktf/lib/importable-resource.ts b/packages/cdktf/lib/importable-resource.ts new file mode 100644 index 0000000000..3ef647b66b --- /dev/null +++ b/packages/cdktf/lib/importable-resource.ts @@ -0,0 +1,42 @@ +import { Construct } from "constructs"; +import { TerraformElement } from "./terraform-element"; +import { TerraformProvider } from "./terraform-provider"; + +export interface IImportableConfig { + terraformResourceType: string; + importId: string; + provider?: TerraformProvider; +} + +/** + * Class used to represent an importable resource. + */ +export class ImportableResource extends TerraformElement { + constructor( + scope: Construct, + name: string, + private readonly config: IImportableConfig + ) { + super(scope, name, config.terraformResourceType); + } + + /** + * Adds this resource to the terraform JSON output. + */ + public toTerraform(): any { + const expectedResourceAddress = `${this.config.terraformResourceType}.${this.friendlyUniqueId}`; + return { + import: { + to: expectedResourceAddress, + id: this.config.importId, + provider: this.config.provider ? this.config.provider.fqn : undefined, + }, + }; + } + + public toMetadata(): any { + return { + importsGeneratingConfiguration: [this.friendlyUniqueId], + }; + } +} diff --git a/packages/cdktf/lib/index.ts b/packages/cdktf/lib/index.ts index 47318d6896..152d2ea11a 100644 --- a/packages/cdktf/lib/index.ts +++ b/packages/cdktf/lib/index.ts @@ -37,6 +37,7 @@ export * from "./terraform-iterator"; export * from "./terraform-provisioner"; export * from "./terraform-conditions"; export * from "./terraform-count"; +export * from "./importable-resource"; // required for JSII because Fn extends from it export * from "./functions/terraform-functions.generated"; From 7d6cee684edc7e9155cb24c1964ef0c45b03c02b Mon Sep 17 00:00:00 2001 From: "hashicorp-copywrite[bot]" <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Date: Thu, 29 Jun 2023 12:10:35 +0000 Subject: [PATCH 36/58] chore: add required copyright headers Signed-off-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> --- packages/@cdktf/cli-core/src/lib/convert.ts | 5 +++++ packages/cdktf/lib/importable-resource.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/@cdktf/cli-core/src/lib/convert.ts b/packages/@cdktf/cli-core/src/lib/convert.ts index 293843b7cf..af3a7df7ff 100644 --- a/packages/@cdktf/cli-core/src/lib/convert.ts +++ b/packages/@cdktf/cli-core/src/lib/convert.ts @@ -1,3 +1,8 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + import * as hcl2cdk from "@cdktf/hcl2cdk"; import { CdktfConfig } from "./cdktf-config"; import { diff --git a/packages/cdktf/lib/importable-resource.ts b/packages/cdktf/lib/importable-resource.ts index 3ef647b66b..c6dc884ed6 100644 --- a/packages/cdktf/lib/importable-resource.ts +++ b/packages/cdktf/lib/importable-resource.ts @@ -1,3 +1,8 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + import { Construct } from "constructs"; import { TerraformElement } from "./terraform-element"; import { TerraformProvider } from "./terraform-provider"; From 675c4b79bfa548182f12c0f303028e9c3478b28c Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 29 Jun 2023 15:26:45 +0200 Subject: [PATCH 37/58] feat: ensure terraform version is high enough --- packages/cdktf/lib/backends/cloud-backend.ts | 8 +++----- packages/cdktf/lib/importable-resource.ts | 7 +++++++ packages/cdktf/lib/terraform-resource.ts | 7 +++++++ .../validations/validate-terraform-version.ts | 16 ++++++++++++++++ website/docs/cdktf/concepts/resources.mdx | 2 ++ 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 packages/cdktf/lib/validations/validate-terraform-version.ts diff --git a/packages/cdktf/lib/backends/cloud-backend.ts b/packages/cdktf/lib/backends/cloud-backend.ts index e2de9a479d..2214a358ba 100644 --- a/packages/cdktf/lib/backends/cloud-backend.ts +++ b/packages/cdktf/lib/backends/cloud-backend.ts @@ -1,11 +1,11 @@ // Copyright (c) HashiCorp, Inc // SPDX-License-Identifier: MPL-2.0 import { Construct } from "constructs"; -import { keysToSnakeCase, deepMerge, terraformBinaryName } from "../util"; +import { keysToSnakeCase, deepMerge } from "../util"; import { DataTerraformRemoteState } from "./remote-backend"; import { TerraformRemoteState } from "../terraform-remote-state"; import { TerraformBackend } from "../terraform-backend"; -import { ValidateBinaryVersion } from "../validations"; +import { ValidateTerraformVersion } from "../validations/validate-terraform-version"; /** * checks whether the given hostname belongs to tfc or (else) to tfe @@ -30,10 +30,8 @@ export class CloudBackend extends TerraformBackend { super(scope, "backend", "cloud"); this.node.addValidation( - new ValidateBinaryVersion( - "terraform", + new ValidateTerraformVersion( ">=1.1", - `${terraformBinaryName} version`, `The cloud block is only supported for Terraform >=1.1. Please upgrade your Terraform version.` ) ); diff --git a/packages/cdktf/lib/importable-resource.ts b/packages/cdktf/lib/importable-resource.ts index c6dc884ed6..f3777f1d46 100644 --- a/packages/cdktf/lib/importable-resource.ts +++ b/packages/cdktf/lib/importable-resource.ts @@ -6,6 +6,7 @@ import { Construct } from "constructs"; import { TerraformElement } from "./terraform-element"; import { TerraformProvider } from "./terraform-provider"; +import { ValidateTerraformVersion } from "./validations/validate-terraform-version"; export interface IImportableConfig { terraformResourceType: string; @@ -23,6 +24,12 @@ export class ImportableResource extends TerraformElement { private readonly config: IImportableConfig ) { super(scope, name, config.terraformResourceType); + this.node.addValidation( + new ValidateTerraformVersion( + ">=1.5", + `Import blocks are only supported for Terraform >=1.5. Please upgrade your Terraform version.` + ) + ); } /** diff --git a/packages/cdktf/lib/terraform-resource.ts b/packages/cdktf/lib/terraform-resource.ts index b348417cf8..45768565b9 100644 --- a/packages/cdktf/lib/terraform-resource.ts +++ b/packages/cdktf/lib/terraform-resource.ts @@ -22,6 +22,7 @@ import { LocalExecProvisioner, RemoteExecProvisioner, } from "./terraform-provisioner"; +import { ValidateTerraformVersion } from "./validations/validate-terraform-version"; const TERRAFORM_RESOURCE_SYMBOL = Symbol.for("cdktf/TerraformResource"); @@ -252,6 +253,12 @@ export class TerraformResource public importFrom(id: string, provider?: TerraformProvider) { this.imported = { id, provider }; + this.node.addValidation( + new ValidateTerraformVersion( + ">=1.5", + `Import blocks are only supported for Terraform >=1.5. Please upgrade your Terraform version.` + ) + ); } public resetImport() { this.imported = undefined; diff --git a/packages/cdktf/lib/validations/validate-terraform-version.ts b/packages/cdktf/lib/validations/validate-terraform-version.ts new file mode 100644 index 0000000000..fba6d5c585 --- /dev/null +++ b/packages/cdktf/lib/validations/validate-terraform-version.ts @@ -0,0 +1,16 @@ +import { terraformBinaryName } from "../util"; +import { ValidateBinaryVersion } from "./validate-binary-version"; + +/** + * Validates the existence of a Terraform binary and with a certain version or higher. + */ +export class ValidateTerraformVersion extends ValidateBinaryVersion { + constructor(protected versionConstraint: string, protected hint?: string) { + super( + terraformBinaryName, + versionConstraint, + `${terraformBinaryName} version`, + hint + ); + } +} diff --git a/website/docs/cdktf/concepts/resources.mdx b/website/docs/cdktf/concepts/resources.mdx index 27c9b4fc79..305e4d75db 100644 --- a/website/docs/cdktf/concepts/resources.mdx +++ b/website/docs/cdktf/concepts/resources.mdx @@ -381,6 +381,8 @@ If you need to use the special [`self` object](/terraform/language/resources/pro If you need to ensure a condition is met either before or after a resource was created you can specify [conditions](/terraform/language/expressions/custom-conditions#preconditions-and-postconditions). To add one configure the `lifecycle` key on your resource with an object containing a `precondition` and / or a `postcondition`. These keys take a list of conditions with a `condition` key containing a Terraform Expression to be evaluated and an `errorMessage` key containing a string to be displayed if the condition is not met. +## Importing Resources + ## Escape Hatch Terraform provides [meta-arguments](/terraform/language/resources/syntax#meta-arguments) to change resource behavior. For example, the `for_each` meta-argument creates multiple resource instances according to a map, or set of strings. The escape hatch allows you to use these meta-arguments to your CDKTF application and to override attributes that CDKTF cannot yet fully express. From 9e7f1d88510e2e3d2d2aec0953369dbacd1ebdd5 Mon Sep 17 00:00:00 2001 From: "hashicorp-copywrite[bot]" <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Date: Thu, 29 Jun 2023 13:27:46 +0000 Subject: [PATCH 38/58] chore: add required copyright headers Signed-off-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> --- packages/cdktf/lib/validations/validate-terraform-version.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/cdktf/lib/validations/validate-terraform-version.ts b/packages/cdktf/lib/validations/validate-terraform-version.ts index fba6d5c585..261d84bf44 100644 --- a/packages/cdktf/lib/validations/validate-terraform-version.ts +++ b/packages/cdktf/lib/validations/validate-terraform-version.ts @@ -1,3 +1,8 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + import { terraformBinaryName } from "../util"; import { ValidateBinaryVersion } from "./validate-binary-version"; From 7bdaa6f586558ca78c51e6cad0861ef3728b9cd5 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 29 Jun 2023 15:58:42 +0200 Subject: [PATCH 39/58] chore: document plannable import --- website/docs/cdktf/concepts/resources.mdx | 228 ++++++++++++++++++++++ 1 file changed, 228 insertions(+) diff --git a/website/docs/cdktf/concepts/resources.mdx b/website/docs/cdktf/concepts/resources.mdx index 305e4d75db..e159e4c40b 100644 --- a/website/docs/cdktf/concepts/resources.mdx +++ b/website/docs/cdktf/concepts/resources.mdx @@ -383,6 +383,234 @@ To add one configure the `lifecycle` key on your resource with an object contain ## Importing Resources +If you have existing resources that you want to manage with CDKTF, you can import them into your CDKTF application. The best way to do this is using the [`import` block feature](/terraform/language/import) of Terraform >= 1.5. You can do this in CDKTF either with a specified configuration or without, which will trigger the configuration generation. + +### Importing with Configuration + +To import a resource with configuration, you write your resource configuration as you would normally. Then you call the `importFrom` method on the resulting resource object. This method takes the resource ID as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. + +```typescript +new S3Bucket(this, "bucket", {}).importFrom(bucketId); +``` + +When running plan / apply you will get the information that one resource is going to be imported. Once you ran apply you can remove the `importFrom` call and the resource will be managed by CDKTF. +The output might look like this: + +``` +ts-import Initializing the backend... +ts-import Initializing provider plugins... +ts-import - Reusing previous version of hashicorp/aws from the dependency lock file +ts-import - Using previously-installed hashicorp/aws v5.5.0 +ts-import Terraform has been successfully initialized! + + You may now begin working with Terraform. Try running "terraform plan" to see + any changes that are required for your infrastructure. All Terraform commands + should now work. + + If you ever set or change modules or backend configuration for Terraform, + rerun this command to reinitialize your working directory. If you forget, other + commands will detect it and remind you to do so if necessary. +ts-import aws_s3_bucket.bucket (bucket): Preparing import... [id=best-bucket-in-the-world] +ts-import aws_s3_bucket.bucket (bucket): Refreshing state... [id=best-bucket-in-the-world] +ts-import Terraform used the selected providers to generate the following execution + plan. Resource actions are indicated with the following symbols: + ~ update in-place + + Terraform will perform the following actions: +ts-import # aws_s3_bucket.bucket (bucket) will be updated in-place + # (imported from "best-bucket-in-the-world") + ~ resource "aws_s3_bucket" "bucket" { + arn = "arn:aws:s3:::best-bucket-in-the-world" + bucket = "best-bucket-in-the-world" + bucket_domain_name = "best-bucket-in-the-world.s3.amazonaws.com" + bucket_regional_domain_name = "best-bucket-in-the-world.s3.us-east-1.amazonaws.com" + + force_destroy = false + hosted_zone_id = "XXXXXXXXXXXXX" + id = "best-bucket-in-the-world" + object_lock_enabled = false + region = "us-east-1" + request_payer = "BucketOwner" + ~ tags = { + - "foo" = "bar" -> null + } + ~ tags_all = { + - "foo" = "bar" + } -> (known after apply) + + grant { + id = "XXXXXXXXXXXXX" + permissions = [ + "FULL_CONTROL", + ] + type = "CanonicalUser" + } + + server_side_encryption_configuration { + rule { + bucket_key_enabled = true + + apply_server_side_encryption_by_default { + sse_algorithm = "AES256" + } + } + } + + versioning { + enabled = true + mfa_delete = false + } + } + + Plan: 1 to import, 0 to add, 1 to change, 0 to destroy. + + ───────────────────────────────────────────────────────────────────────────── + + Saved the plan to: plan + + To perform exactly these actions, run the following command to apply: + terraform apply "plan" +``` + +### Importing without Configuration + +If you want to import a resource without specifying the configuration you can use the instance method `import` on the class of the resource you want to import. This method takes the scope as the first argument, the construct name within the CDKTF program as the second, resource ID as the third argument and the provider as an optional fourth. The provider is only required if you have multiple providers of the same type in your configuration. + +```typescript +S3Bucket.import(this, "bucket", bucketId); +``` + +When running plan / apply you will get the information that one resource is going to be imported. Once you ran plan / apply, CDKTF CLI will return the CDKTF construct. You can use this in your CDKTF application after the the apply and therefore the import is done and replace the `S3Bucket.import` call. +The output might look like this: + +``` +ts-import-with-configuration Initializing the backend... +ts-import-with-configuration Initializing provider plugins... + - Reusing previous version of hashicorp/aws from the dependency lock file +ts-import-with-configuration - Using previously-installed hashicorp/aws v5.5.0 +ts-import-with-configuration Terraform has been successfully initialized! + + You may now begin working with Terraform. Try running "terraform plan" to see + any changes that are required for your infrastructure. All Terraform commands + should now work. + + If you ever set or change modules or backend configuration for Terraform, + rerun this command to reinitialize your working directory. If you forget, other + commands will detect it and remind you to do so if necessary. +ts-import-with-configuration aws_s3_bucket.bucket: Preparing import... [id=best-bucket-in-the-world] +ts-import-with-configuration aws_s3_bucket.bucket: Refreshing state... [id=best-bucket-in-the-world] +ts-import-with-configuration Terraform will perform the following actions: +ts-import-with-configuration # aws_s3_bucket.bucket will be imported + # (config will be generated) + resource "aws_s3_bucket" "bucket" { + arn = "arn:aws:s3:::best-bucket-in-the-world" + bucket = "best-bucket-in-the-world" + bucket_domain_name = "best-bucket-in-the-world.s3.amazonaws.com" + bucket_regional_domain_name = "best-bucket-in-the-world.s3.us-east-1.amazonaws.com" + hosted_zone_id = "XXXXXXXXXXXXX" + id = "best-bucket-in-the-world" + object_lock_enabled = false + region = "us-east-1" + request_payer = "BucketOwner" + tags = { + "foo" = "bar" + } + tags_all = { + "foo" = "bar" + } + + grant { + id = "XXXXXXXXXXXXX" + permissions = [ + "FULL_CONTROL", + ] + type = "CanonicalUser" + } + + server_side_encryption_configuration { + rule { + bucket_key_enabled = true + + apply_server_side_encryption_by_default { + sse_algorithm = "AES256" + } + } + } + + versioning { + enabled = true + mfa_delete = false + } + } + + Plan: 1 to import, 0 to add, 0 to change, 0 to destroy. + +ts-import-with-configuration â•· + │ Warning: Config generation is experimental + │ + │ Generating configuration during import is currently experimental, and the + │ generated configuration format may change in future versions. + ╵ + + ───────────────────────────────────────────────────────────────────────────── + + Terraform has generated configuration and written it to + generated_resources.tf. Please review the configuration and edit it as + necessary before adding it to version control. + + Saved the plan to: plan + + To perform exactly these actions, run the following command to apply: + terraform apply "plan" +ts-import-with-configuration Import without configuration detected. Terraform has created configuration for it: + # __generated__ by Terraform + # Please review these resources and move them into your main configuration files. + + # __generated__ by Terraform from "best-bucket-in-the-world" + resource "aws_s3_bucket" "bucket" { + bucket = "best-bucket-in-the-world" + bucket_prefix = null + force_destroy = null + object_lock_enabled = false + tags = { + foo = "bar" + } + tags_all = { + foo = "bar" + } + } + + + CDKTF has translated the code to the following: + + import { Construct } from "constructs"; + /* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ + import { S3Bucket } from "./.gen/providers/aws/s3-bucket"; + class MyConvertedCode extends Construct { + constructor(scope: Construct, name: string) { + super(scope, name); + new S3Bucket(this, "bucket", { + bucket: "best-bucket-in-the-world", + bucketPrefix: [null], + forceDestroy: [null], + objectLockEnabled: false, + tags: { + foo: "bar", + }, + tagsAll: { + foo: "bar", + }, + }); + } + } + + + Please review the code and make any necessary changes before adding it to your codebase. + Make sure to only copy the code within the construct's constructor. +``` + ## Escape Hatch Terraform provides [meta-arguments](/terraform/language/resources/syntax#meta-arguments) to change resource behavior. For example, the `for_each` meta-argument creates multiple resource instances according to a map, or set of strings. The escape hatch allows you to use these meta-arguments to your CDKTF application and to override attributes that CDKTF cannot yet fully express. From 0d98a3f6808d7bab93a621ff028ba6aeee57f470 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 29 Jun 2023 16:50:47 +0200 Subject: [PATCH 40/58] chore: fix typo --- packages/cdktf/lib/importable-resource.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/cdktf/lib/importable-resource.ts b/packages/cdktf/lib/importable-resource.ts index f3777f1d46..41ff99323a 100644 --- a/packages/cdktf/lib/importable-resource.ts +++ b/packages/cdktf/lib/importable-resource.ts @@ -38,11 +38,13 @@ export class ImportableResource extends TerraformElement { public toTerraform(): any { const expectedResourceAddress = `${this.config.terraformResourceType}.${this.friendlyUniqueId}`; return { - import: { - to: expectedResourceAddress, - id: this.config.importId, - provider: this.config.provider ? this.config.provider.fqn : undefined, - }, + import: [ + { + to: expectedResourceAddress, + id: this.config.importId, + provider: this.config.provider ? this.config.provider.fqn : undefined, + }, + ], }; } From d2b5f83b2603d5d4a4ed6c87789321fb2c021437 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 8 Sep 2023 08:44:06 -0400 Subject: [PATCH 41/58] fix: resolve to fqn of provider in import block --- packages/cdktf/lib/terraform-resource.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cdktf/lib/terraform-resource.ts b/packages/cdktf/lib/terraform-resource.ts index 45768565b9..bdde1de498 100644 --- a/packages/cdktf/lib/terraform-resource.ts +++ b/packages/cdktf/lib/terraform-resource.ts @@ -213,7 +213,7 @@ export class TerraformResource import: this.imported ? [ { - provider: this.imported.provider, + provider: this.imported.provider?.fqn, id: this.imported.id, to: `${this.terraformResourceType}.${this.friendlyUniqueId}`, }, From a87da719d5f41bf9cfce0ae3ee8a053c5eefb43a Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 8 Sep 2023 08:44:53 -0400 Subject: [PATCH 42/58] chore: add unit and integration tests --- .../lib/__tests__/provider.test.ts | 41 +++++++++++- .../test/__snapshots__/resource.test.ts.snap | 64 +++++++++++++++++++ packages/cdktf/test/resource.test.ts | 24 +++++++ test/typescript/import/importFrom/cdktf.json | 8 +++ test/typescript/import/importFrom/main.ts | 23 +++++++ test/typescript/import/importTo/cdktf.json | 8 +++ test/typescript/import/importTo/main.ts | 23 +++++++ test/typescript/import/test.ts | 29 +++++++++ 8 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 test/typescript/import/importFrom/cdktf.json create mode 100644 test/typescript/import/importFrom/main.ts create mode 100644 test/typescript/import/importTo/cdktf.json create mode 100644 test/typescript/import/importTo/main.ts create mode 100644 test/typescript/import/test.ts diff --git a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts index 98745ddc5b..ae0b9978a8 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts @@ -61,5 +61,44 @@ describe("Provider", () => { const snapshot = directorySnapshot(workdir); expect(snapshot).toMatchSnapshot(); }); - }, 600_000); + }, 600_000), + it("generated provider include static import functions", async () => { + const constraint = new TerraformProviderConstraint( + "DataDog/datadog@= 3.12.0" + ); + return await mkdtemp(async (workdir) => { + const jsiiPath = path.join(workdir, ".jsii"); + const maker = new ConstructsMaker({ + codeMakerOutput: workdir, + outputJsii: jsiiPath, + targetLanguage: Language.TYPESCRIPT, + }); + await maker.generate([constraint]); + const snapshot = directorySnapshot(workdir); + + const terraformResourceTypesPresent: string[] = []; + const lines = snapshot.split("\n"); + for (const line of lines) { + if (line.includes("terraformResourceType")) { + // matches the resource type that's in single quotes + terraformResourceTypesPresent.push(line.match(/'([^']+)'/)); + } + } + + const staticImportMethodStrings: string[] = []; + for (const resourceType of terraformResourceTypesPresent) { + staticImportMethodStrings.push(`public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${resourceType}", importId: id, provider }); + }`); + } + console.log( + "terraformResourceTypesPresent", + terraformResourceTypesPresent + ); + console.log("staticImportMethodStrings", staticImportMethodStrings); + staticImportMethodStrings.forEach((staticImport) => { + expect(snapshot).toContain(staticImport); + }); + }); + }, 600_000); }); diff --git a/packages/cdktf/test/__snapshots__/resource.test.ts.snap b/packages/cdktf/test/__snapshots__/resource.test.ts.snap index 96442c70ae..7a43ab856b 100644 --- a/packages/cdktf/test/__snapshots__/resource.test.ts.snap +++ b/packages/cdktf/test/__snapshots__/resource.test.ts.snap @@ -91,6 +91,70 @@ exports[`do not change capitalization of tags 1`] = ` }" `; +exports[`includes import block when import is present 1`] = ` +"{ + "import": [ + { + "id": "testId", + "to": "test_resource.test" + } + ], + "provider": { + "test": [ + { + } + ] + }, + "resource": { + "test_resource": { + "test": { + "name": "foo" + } + } + }, + "terraform": { + "required_providers": { + "test": { + "version": "~> 2.0" + } + } + } +}" +`; + +exports[`includes import block when import is present, provider given 1`] = ` +"{ + "import": [ + { + "id": "testId", + "provider": "test.foo", + "to": "test_resource.test" + } + ], + "provider": { + "test": [ + { + "alias": "foo" + } + ] + }, + "resource": { + "test_resource": { + "test": { + "name": "foo" + } + } + }, + "terraform": { + "required_providers": { + "test": { + "version": "~> 2.0" + } + } + } +}" +`; + exports[`maintains the same order of provisioner 1`] = ` "{ "provider": { diff --git a/packages/cdktf/test/resource.test.ts b/packages/cdktf/test/resource.test.ts index dc5bff0279..4b5bb9dc2f 100644 --- a/packages/cdktf/test/resource.test.ts +++ b/packages/cdktf/test/resource.test.ts @@ -320,3 +320,27 @@ it("maintains the same order of provisioner", () => { expect(Testing.synth(stack)).toMatchSnapshot(); }); + +test("includes import block when import is present", () => { + const app = Testing.app(); + const stack = new TerraformStack(app, "test"); + new TestProvider(stack, "provider", {}); + + new TestResource(stack, "test", { + name: "foo", + }).importFrom("testId"); + expect(Testing.synth(stack)).toMatchSnapshot(); +}); + +test("includes import block when import is present, provider given", () => { + const app = Testing.app(); + const stack = new TerraformStack(app, "test"); + const provider = new TestProvider(stack, "provider", { + alias: "foo", + }); + new TestResource(stack, "test", { + name: "foo", + }).importFrom("testId", provider); + console.log("stack with provider", Testing.synth(stack)); + expect(Testing.synth(stack)).toMatchSnapshot(); +}); diff --git a/test/typescript/import/importFrom/cdktf.json b/test/typescript/import/importFrom/cdktf.json new file mode 100644 index 0000000000..a6ff3e5cc5 --- /dev/null +++ b/test/typescript/import/importFrom/cdktf.json @@ -0,0 +1,8 @@ +{ + "language": "typescript", + "app": "npm run --silent compile && node main.js", + "terraformProviders": [ + "hashicorp/random@ ~> 3.5.0" + ], + "context": {} +} \ No newline at end of file diff --git a/test/typescript/import/importFrom/main.ts b/test/typescript/import/importFrom/main.ts new file mode 100644 index 0000000000..96687a2b22 --- /dev/null +++ b/test/typescript/import/importFrom/main.ts @@ -0,0 +1,23 @@ +// Copyright (c) HashiCorp, Inc +// SPDX-License-Identifier: MPL-2.0 +import { Construct } from "constructs"; +import { App, TerraformStack } from "cdktf"; +import { RandomProvider } from "./.gen/providers/random/provider"; +import { Integer } from "./.gen/providers/random/integer"; + +class StackWithImport extends TerraformStack { + constructor(scope: Construct, ns: string) { + super(scope, ns); + + new RandomProvider(this, "random", {}); + + new Integer(this, "random-integer-import-from", { + max: 100, + min: 1, + }); + } +} + +const app = new App(); +new StackWithImport(app, "ts-import-from"); +app.synth(); diff --git a/test/typescript/import/importTo/cdktf.json b/test/typescript/import/importTo/cdktf.json new file mode 100644 index 0000000000..a6ff3e5cc5 --- /dev/null +++ b/test/typescript/import/importTo/cdktf.json @@ -0,0 +1,8 @@ +{ + "language": "typescript", + "app": "npm run --silent compile && node main.js", + "terraformProviders": [ + "hashicorp/random@ ~> 3.5.0" + ], + "context": {} +} \ No newline at end of file diff --git a/test/typescript/import/importTo/main.ts b/test/typescript/import/importTo/main.ts new file mode 100644 index 0000000000..bb74b64e55 --- /dev/null +++ b/test/typescript/import/importTo/main.ts @@ -0,0 +1,23 @@ +// Copyright (c) HashiCorp, Inc +// SPDX-License-Identifier: MPL-2.0 +import { Construct } from "constructs"; +import { App, TerraformStack } from "cdktf"; +import { ImportableResource } from "cdktf"; +import { RandomProvider } from "./.gen/providers/random/provider"; +import { Integer } from "./.gen/providers/random/integer"; + +class StackWithImport extends TerraformStack { + constructor(scope: Construct, ns: string) { + super(scope, ns); + + const integerId = "random-integer-import-from"; + + new RandomProvider(this, "random", {}); + + Integer.import(this, "random-integer-import-to", integerId); + } +} + +const app = new App(); +new StackWithImport(app, "ts-import-to"); +app.synth(); diff --git a/test/typescript/import/test.ts b/test/typescript/import/test.ts new file mode 100644 index 0000000000..9c2e8899f0 --- /dev/null +++ b/test/typescript/import/test.ts @@ -0,0 +1,29 @@ +// Copyright (c) HashiCorp, Inc +// SPDX-License-Identifier: MPL-2.0 +import { TestDriver } from "../../test-helper"; + +describe("import block", () => { + let driverImportFrom: TestDriver; + let driverImportTo: TestDriver; + + beforeAll(async () => { + driverImportFrom = new TestDriver(`${__dirname}/importFrom`); + await driverImportFrom.setupTypescriptProject(); + + driverImportTo = new TestDriver(`${__dirname}/importTo`); + await driverImportTo.setupTypescriptProject(); + }, 600_000); + + test("resource is imported correctly", async () => { + const result = await driverImportFrom.exec("cat package.json"); + console.log("all the files", result); + await driverImportFrom.deploy(["ts-import-from"]); + + await driverImportTo.deploy(["ts-import-to"]); + + const res = await driverImportTo.exec( + "cat $PWD/cdktf.out/stacks/ts-import-to/cdk.tf.json" + ); + console.log(res); + }, 600_000); +}); From cf0f4d68f2f964a596af959ac38f8d97ea141d6b Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 8 Sep 2023 15:57:38 -0400 Subject: [PATCH 43/58] chore: correctly access snapshot in provider test of provider-generator --- .../lib/__tests__/provider.test.ts | 43 ++++++++++--------- test/typescript/import/importFrom/cdktf.json | 8 ---- test/typescript/import/importFrom/main.ts | 23 ---------- test/typescript/import/importTo/cdktf.json | 8 ---- test/typescript/import/importTo/main.ts | 23 ---------- test/typescript/import/test.ts | 29 ------------- 6 files changed, 23 insertions(+), 111 deletions(-) delete mode 100644 test/typescript/import/importFrom/cdktf.json delete mode 100644 test/typescript/import/importFrom/main.ts delete mode 100644 test/typescript/import/importTo/cdktf.json delete mode 100644 test/typescript/import/importTo/main.ts delete mode 100644 test/typescript/import/test.ts diff --git a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts index ae0b9978a8..cd3c4097e7 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts @@ -62,7 +62,7 @@ describe("Provider", () => { expect(snapshot).toMatchSnapshot(); }); }, 600_000), - it("generated provider include static import functions", async () => { + it.only("has generated provider that includes static import functions", async () => { const constraint = new TerraformProviderConstraint( "DataDog/datadog@= 3.12.0" ); @@ -77,27 +77,30 @@ describe("Provider", () => { const snapshot = directorySnapshot(workdir); const terraformResourceTypesPresent: string[] = []; - const lines = snapshot.split("\n"); - for (const line of lines) { - if (line.includes("terraformResourceType")) { - // matches the resource type that's in single quotes - terraformResourceTypesPresent.push(line.match(/'([^']+)'/)); + const files = Object.keys(snapshot); + for (const file of files) { + const match = file.match(/providers\/datadog\/(.*?)\/index\.ts/); + // avoids any not resources from being pushed + if ( + match && + !match[1].includes("/") && + !match[1].includes("data-") && + !match[1].includes("provider") + ) { + terraformResourceTypesPresent.push(match[1]); } } - - const staticImportMethodStrings: string[] = []; - for (const resourceType of terraformResourceTypesPresent) { - staticImportMethodStrings.push(`public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${resourceType}", importId: id, provider }); - }`); - } - console.log( - "terraformResourceTypesPresent", - terraformResourceTypesPresent - ); - console.log("staticImportMethodStrings", staticImportMethodStrings); - staticImportMethodStrings.forEach((staticImport) => { - expect(snapshot).toContain(staticImport); + terraformResourceTypesPresent.forEach((resource) => { + let terraformResourceType = resource.replace(/-/g, "_"); + if (!terraformResourceType.includes("datadog")) { + terraformResourceType = `datadog_${terraformResourceType}`; + } + expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( + `public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider)` + ); + expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( + `return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${terraformResourceType}", importId: id, provider });` + ); }); }); }, 600_000); diff --git a/test/typescript/import/importFrom/cdktf.json b/test/typescript/import/importFrom/cdktf.json deleted file mode 100644 index a6ff3e5cc5..0000000000 --- a/test/typescript/import/importFrom/cdktf.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "language": "typescript", - "app": "npm run --silent compile && node main.js", - "terraformProviders": [ - "hashicorp/random@ ~> 3.5.0" - ], - "context": {} -} \ No newline at end of file diff --git a/test/typescript/import/importFrom/main.ts b/test/typescript/import/importFrom/main.ts deleted file mode 100644 index 96687a2b22..0000000000 --- a/test/typescript/import/importFrom/main.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) HashiCorp, Inc -// SPDX-License-Identifier: MPL-2.0 -import { Construct } from "constructs"; -import { App, TerraformStack } from "cdktf"; -import { RandomProvider } from "./.gen/providers/random/provider"; -import { Integer } from "./.gen/providers/random/integer"; - -class StackWithImport extends TerraformStack { - constructor(scope: Construct, ns: string) { - super(scope, ns); - - new RandomProvider(this, "random", {}); - - new Integer(this, "random-integer-import-from", { - max: 100, - min: 1, - }); - } -} - -const app = new App(); -new StackWithImport(app, "ts-import-from"); -app.synth(); diff --git a/test/typescript/import/importTo/cdktf.json b/test/typescript/import/importTo/cdktf.json deleted file mode 100644 index a6ff3e5cc5..0000000000 --- a/test/typescript/import/importTo/cdktf.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "language": "typescript", - "app": "npm run --silent compile && node main.js", - "terraformProviders": [ - "hashicorp/random@ ~> 3.5.0" - ], - "context": {} -} \ No newline at end of file diff --git a/test/typescript/import/importTo/main.ts b/test/typescript/import/importTo/main.ts deleted file mode 100644 index bb74b64e55..0000000000 --- a/test/typescript/import/importTo/main.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) HashiCorp, Inc -// SPDX-License-Identifier: MPL-2.0 -import { Construct } from "constructs"; -import { App, TerraformStack } from "cdktf"; -import { ImportableResource } from "cdktf"; -import { RandomProvider } from "./.gen/providers/random/provider"; -import { Integer } from "./.gen/providers/random/integer"; - -class StackWithImport extends TerraformStack { - constructor(scope: Construct, ns: string) { - super(scope, ns); - - const integerId = "random-integer-import-from"; - - new RandomProvider(this, "random", {}); - - Integer.import(this, "random-integer-import-to", integerId); - } -} - -const app = new App(); -new StackWithImport(app, "ts-import-to"); -app.synth(); diff --git a/test/typescript/import/test.ts b/test/typescript/import/test.ts deleted file mode 100644 index 9c2e8899f0..0000000000 --- a/test/typescript/import/test.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) HashiCorp, Inc -// SPDX-License-Identifier: MPL-2.0 -import { TestDriver } from "../../test-helper"; - -describe("import block", () => { - let driverImportFrom: TestDriver; - let driverImportTo: TestDriver; - - beforeAll(async () => { - driverImportFrom = new TestDriver(`${__dirname}/importFrom`); - await driverImportFrom.setupTypescriptProject(); - - driverImportTo = new TestDriver(`${__dirname}/importTo`); - await driverImportTo.setupTypescriptProject(); - }, 600_000); - - test("resource is imported correctly", async () => { - const result = await driverImportFrom.exec("cat package.json"); - console.log("all the files", result); - await driverImportFrom.deploy(["ts-import-from"]); - - await driverImportTo.deploy(["ts-import-to"]); - - const res = await driverImportTo.exec( - "cat $PWD/cdktf.out/stacks/ts-import-to/cdk.tf.json" - ); - console.log(res); - }, 600_000); -}); From cb4eba6249c457a1a9c906f09e32a03ce2a550d6 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 8 Sep 2023 16:41:53 -0400 Subject: [PATCH 44/58] chore: update provider-generator snapshots to include new static import functions --- .../complex-computed-types.test.ts.snap | 7 + .../description-escaping.test.ts.snap | 14 ++ .../export-sharding.test.ts.snap | 14 ++ .../__snapshots__/nested-types.test.ts.snap | 7 + .../__snapshots__/provider.test.ts.snap | 14 ++ .../__snapshots__/resource-types.test.ts.snap | 28 +++ .../skipped-attributes.test.ts.snap | 7 + .../__snapshots__/types.test.ts.snap | 210 ++++++++++++++++++ 8 files changed, 301 insertions(+) diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap index 6abefde4e0..816fcb19a1 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap @@ -211,6 +211,13 @@ export class AcmCertificate extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_acm_certificate"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_acm_certificate", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap index 38e63ec64d..7f944bf1c1 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap @@ -34,6 +34,13 @@ export class DescriptionEscaping extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "description_escaping"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "description_escaping", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -208,6 +215,13 @@ export class CodeBlocks extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "code_blocks"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap index d24f876950..63cfa4842e 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap @@ -107,6 +107,13 @@ export class Dashboard extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_dashboard"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "datadog_dashboard", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -146861,6 +146868,13 @@ export class Wafv2WebAcl extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_wafv2_web_acl"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_wafv2_web_acl", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap index 15b882c4bf..f4be4d5dca 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap @@ -300,6 +300,13 @@ export class NestedTypesResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "nested_types_resource"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "nested_types_resource", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap index a52eae810c..fcf867bb7c 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap @@ -1170,6 +1170,13 @@ export class AwsProvider extends cdktf.TerraformProvider { // ================= public static readonly tfResourceType = "aws"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1687,6 +1694,13 @@ export class ElasticstackProvider extends cdktf.TerraformProvider { // ================= public static readonly tfResourceType = "elasticstack"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "elasticstack", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap index e61b4f0aac..ce4a768935 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap @@ -4020,6 +4020,13 @@ export class CloudfrontDistribution extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_cloudfront_distribution"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_cloudfront_distribution", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -4505,6 +4512,13 @@ export class FmsAdminAccount extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_fms_admin_account"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_fms_admin_account", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -7519,6 +7533,13 @@ export class S3Bucket extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_s3_bucket"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_s3_bucket", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -8781,6 +8802,13 @@ export class SecurityGroup extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_security_group"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_security_group", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap index 1ba36d8779..0ff8677873 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap @@ -688,6 +688,13 @@ export class QuicksightTemplate extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_quicksight_template"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_quicksight_template", importId: id, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap index 569a70c078..41d60e81dd 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap @@ -30,6 +30,13 @@ export class BooleanList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_boolean_list"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_list", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -142,6 +149,13 @@ export class BooleanMap extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_boolean_map"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_map", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -353,6 +367,13 @@ export class ComputedComplex extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_computed_complex"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -558,6 +579,13 @@ export class ComputedComplexNested extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_computed_complex_nested"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex_nested", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -809,6 +837,13 @@ export class BlockTypeNestedComputedList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_block_type_nested_computed_list"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_nested_computed_list", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1209,6 +1244,13 @@ export class ComputedOptionalComplex extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_computed_optional_complex"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_optional_complex", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1489,6 +1531,13 @@ export class DeeplyNestedBlockTypes extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_deeply_nested_block_types"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_deeply_nested_block_types", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1579,6 +1628,13 @@ export class IgnoredAttributes extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_ignored_attributes"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_ignored_attributes", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1687,6 +1743,13 @@ export class IncompatibleAttributeNames extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_incompatible_attribute_names"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_incompatible_attribute_names", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1834,6 +1897,13 @@ export class FunctionResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_function"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_function", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -1945,6 +2015,13 @@ export class LicenseResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_license"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_license", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -2032,6 +2109,13 @@ export class ObjectResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_object"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_object", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -2119,6 +2203,13 @@ export class ProviderResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_provider"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_provider", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -2206,6 +2297,13 @@ export class StaticResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_static"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_static", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -2293,6 +2391,13 @@ export class StringResource extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_string"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_string", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -2728,6 +2833,13 @@ export class Complex extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "test_complex"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_complex", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -2932,6 +3044,13 @@ export class DataAirbyteSourceSchemaCatalog extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "airbyte_source_schema_catalog"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "airbyte_source_schema_catalog", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3027,6 +3146,13 @@ export class ListOfStringMap extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_list_of_string_map"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_list_of_string_map", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3122,6 +3248,13 @@ export class MapOfStringList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_map_of_string_list"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_map_of_string_list", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3219,6 +3352,13 @@ export class NumberList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_number_list"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_list", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3325,6 +3465,13 @@ export class NumberMap extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_number_map"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_map", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3444,6 +3591,13 @@ export class PrimitiveBoolean extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_primitive_boolean"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_boolean", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3577,6 +3731,13 @@ export class PrimitiveDynamic extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_primitive_dynamic"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_dynamic", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3711,6 +3872,13 @@ export class PrimitiveNumber extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_primitive_number"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_number", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3844,6 +4012,13 @@ export class PrimitiveString extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_primitive_string"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_string", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -3981,6 +4156,13 @@ export class NameConflict extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_name_conflict"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_name_conflict", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -4324,6 +4506,13 @@ export class BlockTypeSetList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_block_type_set_list"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_set_list", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -4506,6 +4695,13 @@ export class SingleBlockType extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_single_block_type"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_single_block_type", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -4601,6 +4797,13 @@ export class StringList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_string_list"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_list", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -4734,6 +4937,13 @@ export class StringMap extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "aws_string_map"; + // ============== + // STATIC Methods + // ============== + public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_map", importId: id, provider }); + } + // =========== // INITIALIZER // =========== From 8eb2b8aae85152d8774a0f4b123b7868bcd1025f Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 20 Sep 2023 09:11:42 -0400 Subject: [PATCH 45/58] fix: only add generate config flag to plan when imports present --- .../cli-core/src/lib/models/terraform-cli.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts index 0d2c4aca82..5a99ebbcbe 100644 --- a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts +++ b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts @@ -200,6 +200,14 @@ export class TerraformCli implements Terraform { ); } + private get hasImports(): boolean { + const parsedStack = terraformJsonSchema.parse( + JSON.parse(this.stack.content) + ); + + return Boolean(parsedStack.import); + } + public async plan(opts: { destroy: boolean; refreshOnly?: boolean; @@ -216,11 +224,7 @@ export class TerraformCli implements Terraform { varFiles = [], noColor = false, } = opts; - const options = [ - "plan", - "-input=false", - "-generate-config-out=generated_resources.tf", - ]; + const options = ["plan", "-input=false"]; const generatedConfigFile = path.join( this.workdir, @@ -229,7 +233,9 @@ export class TerraformCli implements Terraform { if (fs.existsSync(generatedConfigFile)) { fs.remove(generatedConfigFile); } - + if (this.hasImports) { + options.push("-generate-config-out=generated_resources.tf"); + } if (!this.isCloudStack) { const planFile = "plan"; options.push("-out", planFile); From 8d1578917bf05db6348580f208ccc12b192f6cc7 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 20 Sep 2023 10:04:20 -0400 Subject: [PATCH 46/58] fix: renamed static function import -> importOf to avoid common naming collision in providers --- .../lib/get/generator/emitter/resource-emitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts index ca39b9f8ee..4988afcd5c 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts @@ -57,7 +57,7 @@ export class ResourceEmitter { private emitStaticMethods(resource: ResourceModel) { this.code.line( - `public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + `public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${resource.terraformResourceType}", importId: id, provider }); }` ); From 3bb44726a3309b7eb0d061ff4974bda61d1b3aec Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 20 Sep 2023 11:41:09 -0400 Subject: [PATCH 47/58] chore: update tests to match new static function name --- .../lib/__tests__/provider.test.ts | 2 +- .../complex-computed-types.test.ts.snap | 2 +- .../description-escaping.test.ts.snap | 11 +++- .../export-sharding.test.ts.snap | 4 +- .../__snapshots__/nested-types.test.ts.snap | 2 +- .../__snapshots__/provider.test.ts.snap | 4 +- .../__snapshots__/resource-types.test.ts.snap | 8 +-- .../skipped-attributes.test.ts.snap | 2 +- .../__snapshots__/types.test.ts.snap | 60 +++++++++---------- 9 files changed, 51 insertions(+), 44 deletions(-) diff --git a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts index cd3c4097e7..ed18c25634 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts @@ -96,7 +96,7 @@ describe("Provider", () => { terraformResourceType = `datadog_${terraformResourceType}`; } expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( - `public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider)` + `public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider)` ); expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( `return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${terraformResourceType}", importId: id, provider });` diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap index 816fcb19a1..99d459c907 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap @@ -214,7 +214,7 @@ export class AcmCertificate extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_acm_certificate", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap index 7f944bf1c1..ec5c49346a 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap @@ -37,7 +37,7 @@ export class DescriptionEscaping extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "description_escaping", importId: id, provider }); } @@ -129,6 +129,13 @@ export class CodeBlocks extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "code_blocks"; + // ============== + // STATIC Methods + // ============== + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); + } + // =========== // INITIALIZER // =========== @@ -218,7 +225,7 @@ export class CodeBlocks extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap index 63cfa4842e..4c74f9b89a 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap @@ -110,7 +110,7 @@ export class Dashboard extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "datadog_dashboard", importId: id, provider }); } @@ -146871,7 +146871,7 @@ export class Wafv2WebAcl extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_wafv2_web_acl", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap index f4be4d5dca..f64e89d49e 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap @@ -303,7 +303,7 @@ export class NestedTypesResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "nested_types_resource", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap index fcf867bb7c..3b8322aa0f 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap @@ -1173,7 +1173,7 @@ export class AwsProvider extends cdktf.TerraformProvider { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws", importId: id, provider }); } @@ -1697,7 +1697,7 @@ export class ElasticstackProvider extends cdktf.TerraformProvider { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "elasticstack", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap index ce4a768935..31a89ea286 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap @@ -4023,7 +4023,7 @@ export class CloudfrontDistribution extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_cloudfront_distribution", importId: id, provider }); } @@ -4515,7 +4515,7 @@ export class FmsAdminAccount extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_fms_admin_account", importId: id, provider }); } @@ -7536,7 +7536,7 @@ export class S3Bucket extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_s3_bucket", importId: id, provider }); } @@ -8805,7 +8805,7 @@ export class SecurityGroup extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_security_group", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap index 0ff8677873..b609531776 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap @@ -691,7 +691,7 @@ export class QuicksightTemplate extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_quicksight_template", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap index 41d60e81dd..1a798e3c51 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap @@ -33,7 +33,7 @@ export class BooleanList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_list", importId: id, provider }); } @@ -152,7 +152,7 @@ export class BooleanMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_map", importId: id, provider }); } @@ -370,7 +370,7 @@ export class ComputedComplex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex", importId: id, provider }); } @@ -582,7 +582,7 @@ export class ComputedComplexNested extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex_nested", importId: id, provider }); } @@ -840,7 +840,7 @@ export class BlockTypeNestedComputedList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_nested_computed_list", importId: id, provider }); } @@ -1247,7 +1247,7 @@ export class ComputedOptionalComplex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_optional_complex", importId: id, provider }); } @@ -1534,7 +1534,7 @@ export class DeeplyNestedBlockTypes extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_deeply_nested_block_types", importId: id, provider }); } @@ -1631,7 +1631,7 @@ export class IgnoredAttributes extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_ignored_attributes", importId: id, provider }); } @@ -1746,7 +1746,7 @@ export class IncompatibleAttributeNames extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_incompatible_attribute_names", importId: id, provider }); } @@ -1900,7 +1900,7 @@ export class FunctionResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_function", importId: id, provider }); } @@ -2018,7 +2018,7 @@ export class LicenseResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_license", importId: id, provider }); } @@ -2112,7 +2112,7 @@ export class ObjectResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_object", importId: id, provider }); } @@ -2206,7 +2206,7 @@ export class ProviderResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_provider", importId: id, provider }); } @@ -2300,7 +2300,7 @@ export class StaticResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_static", importId: id, provider }); } @@ -2394,7 +2394,7 @@ export class StringResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_string", importId: id, provider }); } @@ -2836,7 +2836,7 @@ export class Complex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_complex", importId: id, provider }); } @@ -3047,7 +3047,7 @@ export class DataAirbyteSourceSchemaCatalog extends cdktf.TerraformDataSource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "airbyte_source_schema_catalog", importId: id, provider }); } @@ -3149,7 +3149,7 @@ export class ListOfStringMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_list_of_string_map", importId: id, provider }); } @@ -3251,7 +3251,7 @@ export class MapOfStringList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_map_of_string_list", importId: id, provider }); } @@ -3355,7 +3355,7 @@ export class NumberList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_list", importId: id, provider }); } @@ -3468,7 +3468,7 @@ export class NumberMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_map", importId: id, provider }); } @@ -3594,7 +3594,7 @@ export class PrimitiveBoolean extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_boolean", importId: id, provider }); } @@ -3734,7 +3734,7 @@ export class PrimitiveDynamic extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_dynamic", importId: id, provider }); } @@ -3875,7 +3875,7 @@ export class PrimitiveNumber extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_number", importId: id, provider }); } @@ -4015,7 +4015,7 @@ export class PrimitiveString extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_string", importId: id, provider }); } @@ -4159,7 +4159,7 @@ export class NameConflict extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_name_conflict", importId: id, provider }); } @@ -4509,7 +4509,7 @@ export class BlockTypeSetList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_set_list", importId: id, provider }); } @@ -4698,7 +4698,7 @@ export class SingleBlockType extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_single_block_type", importId: id, provider }); } @@ -4800,7 +4800,7 @@ export class StringList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_list", importId: id, provider }); } @@ -4940,7 +4940,7 @@ export class StringMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static import(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_map", importId: id, provider }); } From b18a60ff68d57615494079843c537a5eae36f17d Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 20 Sep 2023 13:52:32 -0400 Subject: [PATCH 48/58] fix: use right static function in import example --- examples/typescript/aws-import/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/typescript/aws-import/main.ts b/examples/typescript/aws-import/main.ts index 30265d5cc5..9defc67c50 100644 --- a/examples/typescript/aws-import/main.ts +++ b/examples/typescript/aws-import/main.ts @@ -38,7 +38,7 @@ class StackWithImportAndConfigurationGeneration extends TerraformStack { }); // Step 2: Create import block - S3Bucket.import(this, "bucket", bucketId); + S3Bucket.importOf(this, "bucket", bucketId); // Step 3: Run `cdktf plan` and get the configuration to put in below // Step 4: Remove the `import` call, the resource is now imported From 514c2ae95a0725560558cdd48dde3ff97a8a9135 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Thu, 21 Sep 2023 09:19:27 -0400 Subject: [PATCH 49/58] fix: corrected java gradle base cdktf versions --- examples/java/azure-gradle/build.gradle | 2 +- examples/java/documentation-gradle/build.gradle | 2 +- examples/java/google-gradle/build.gradle | 2 +- examples/java/kubernetes-gradle/build.gradle | 2 +- examples/java/ucloud-gradle/build.gradle | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/java/azure-gradle/build.gradle b/examples/java/azure-gradle/build.gradle index 1e1b11e593..ee535feead 100644 --- a/examples/java/azure-gradle/build.gradle +++ b/examples/java/azure-gradle/build.gradle @@ -20,7 +20,7 @@ repositories { } dependencies { - implementation "com.hashicorp:cdktf:0.17.3" + implementation "com.hashicorp:cdktf:0.0.0" implementation "software.constructs:constructs:10.0.25" implementation "junit:junit:4.13.2" implementation "org.junit.jupiter:junit-jupiter:5.8.0" diff --git a/examples/java/documentation-gradle/build.gradle b/examples/java/documentation-gradle/build.gradle index 2e19ab1587..bd40f7f181 100644 --- a/examples/java/documentation-gradle/build.gradle +++ b/examples/java/documentation-gradle/build.gradle @@ -20,7 +20,7 @@ repositories { } dependencies { - implementation "com.hashicorp:cdktf:0.17.3" + implementation "com.hashicorp:cdktf:0.0.0" implementation "software.constructs:constructs:10.0.25" implementation "junit:junit:4.13.2" implementation "org.junit.jupiter:junit-jupiter:5.8.0" diff --git a/examples/java/google-gradle/build.gradle b/examples/java/google-gradle/build.gradle index 419047198c..82bfc6428d 100644 --- a/examples/java/google-gradle/build.gradle +++ b/examples/java/google-gradle/build.gradle @@ -20,7 +20,7 @@ repositories { } dependencies { - implementation "com.hashicorp:cdktf:0.17.3" + implementation "com.hashicorp:cdktf:0.0.0" implementation "software.constructs:constructs:10.0.25" implementation "junit:junit:4.13.2" implementation "org.junit.jupiter:junit-jupiter:5.8.0" diff --git a/examples/java/kubernetes-gradle/build.gradle b/examples/java/kubernetes-gradle/build.gradle index f24c719ca3..791e8fbd9b 100644 --- a/examples/java/kubernetes-gradle/build.gradle +++ b/examples/java/kubernetes-gradle/build.gradle @@ -20,7 +20,7 @@ repositories { } dependencies { - implementation "com.hashicorp:cdktf:0.17.3" + implementation "com.hashicorp:cdktf:0.0.0" implementation "software.constructs:constructs:10.0.25" implementation "junit:junit:4.13.2" implementation "org.junit.jupiter:junit-jupiter:5.8.0" diff --git a/examples/java/ucloud-gradle/build.gradle b/examples/java/ucloud-gradle/build.gradle index 07e9703ebf..cd152716b8 100644 --- a/examples/java/ucloud-gradle/build.gradle +++ b/examples/java/ucloud-gradle/build.gradle @@ -20,7 +20,7 @@ repositories { } dependencies { - implementation "com.hashicorp:cdktf:0.17.3" + implementation "com.hashicorp:cdktf:0.0.0" implementation "software.constructs:constructs:10.0.25" implementation "junit:junit:4.13.2" implementation "org.junit.jupiter:junit-jupiter:5.8.0" From c6c4028401af56afeda04295db6965b47c46e3cc Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Thu, 21 Sep 2023 15:55:56 -0400 Subject: [PATCH 50/58] fix: java gradle reinstall script --- examples/java/aws-gradle/build.gradle | 8 ++++---- examples/java/aws-gradle/reinstall.sh | 2 +- examples/java/azure-gradle/reinstall.sh | 2 +- examples/java/documentation-gradle/reinstall.sh | 2 +- examples/java/google-gradle/reinstall.sh | 2 +- examples/java/kubernetes-gradle/reinstall.sh | 2 +- examples/java/ucloud-gradle/reinstall.sh | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/java/aws-gradle/build.gradle b/examples/java/aws-gradle/build.gradle index f05695a5d9..191a6f4e16 100644 --- a/examples/java/aws-gradle/build.gradle +++ b/examples/java/aws-gradle/build.gradle @@ -24,10 +24,10 @@ repositories { } dependencies { - implementation 'com.hashicorp:cdktf:0.0.0' - implementation 'software.constructs:constructs:10.0.25' - implementation 'junit:junit:4.13.2' - implementation 'org.junit.jupiter:junit-jupiter:5.8.0' + implementation "com.hashicorp:cdktf:0.0.0" + implementation "software.constructs:constructs:10.0.25" + implementation "junit:junit:4.13.2" + implementation "org.junit.jupiter:junit-jupiter:5.8.0" } group = 'com.mycompany.app' diff --git a/examples/java/aws-gradle/reinstall.sh b/examples/java/aws-gradle/reinstall.sh index 0fc20788ef..bd05d19484 100755 --- a/examples/java/aws-gradle/reinstall.sh +++ b/examples/java/aws-gradle/reinstall.sh @@ -5,4 +5,4 @@ set -ex -sed -i "s/implementation 'com.hashicorp:cdktf:0.0.0'/implementation files(\"..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar\")/" build.gradle \ No newline at end of file +sed -i 's/"com\.hashicorp:cdktf:0\.0\.0"/files("..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar")/g' build.gradle \ No newline at end of file diff --git a/examples/java/azure-gradle/reinstall.sh b/examples/java/azure-gradle/reinstall.sh index 0fc20788ef..bd05d19484 100755 --- a/examples/java/azure-gradle/reinstall.sh +++ b/examples/java/azure-gradle/reinstall.sh @@ -5,4 +5,4 @@ set -ex -sed -i "s/implementation 'com.hashicorp:cdktf:0.0.0'/implementation files(\"..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar\")/" build.gradle \ No newline at end of file +sed -i 's/"com\.hashicorp:cdktf:0\.0\.0"/files("..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar")/g' build.gradle \ No newline at end of file diff --git a/examples/java/documentation-gradle/reinstall.sh b/examples/java/documentation-gradle/reinstall.sh index 0fc20788ef..bd05d19484 100755 --- a/examples/java/documentation-gradle/reinstall.sh +++ b/examples/java/documentation-gradle/reinstall.sh @@ -5,4 +5,4 @@ set -ex -sed -i "s/implementation 'com.hashicorp:cdktf:0.0.0'/implementation files(\"..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar\")/" build.gradle \ No newline at end of file +sed -i 's/"com\.hashicorp:cdktf:0\.0\.0"/files("..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar")/g' build.gradle \ No newline at end of file diff --git a/examples/java/google-gradle/reinstall.sh b/examples/java/google-gradle/reinstall.sh index 0fc20788ef..bd05d19484 100755 --- a/examples/java/google-gradle/reinstall.sh +++ b/examples/java/google-gradle/reinstall.sh @@ -5,4 +5,4 @@ set -ex -sed -i "s/implementation 'com.hashicorp:cdktf:0.0.0'/implementation files(\"..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar\")/" build.gradle \ No newline at end of file +sed -i 's/"com\.hashicorp:cdktf:0\.0\.0"/files("..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar")/g' build.gradle \ No newline at end of file diff --git a/examples/java/kubernetes-gradle/reinstall.sh b/examples/java/kubernetes-gradle/reinstall.sh index 0fc20788ef..bd05d19484 100755 --- a/examples/java/kubernetes-gradle/reinstall.sh +++ b/examples/java/kubernetes-gradle/reinstall.sh @@ -5,4 +5,4 @@ set -ex -sed -i "s/implementation 'com.hashicorp:cdktf:0.0.0'/implementation files(\"..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar\")/" build.gradle \ No newline at end of file +sed -i 's/"com\.hashicorp:cdktf:0\.0\.0"/files("..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar")/g' build.gradle \ No newline at end of file diff --git a/examples/java/ucloud-gradle/reinstall.sh b/examples/java/ucloud-gradle/reinstall.sh index 0fc20788ef..5555a2cd0d 100755 --- a/examples/java/ucloud-gradle/reinstall.sh +++ b/examples/java/ucloud-gradle/reinstall.sh @@ -5,4 +5,4 @@ set -ex -sed -i "s/implementation 'com.hashicorp:cdktf:0.0.0'/implementation files(\"..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar\")/" build.gradle \ No newline at end of file +sed -i 's/"com\.hashicorp:cdktf:0\.0\.0"/files("..\/..\/..\/dist\/java\/com\/hashicorp\/cdktf\/0.0.0\/cdktf-0.0.0.jar")/g' build.gradle From 4c7714aaf474a1b0190ac1956987bfa281995fcd Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Thu, 21 Sep 2023 16:30:36 -0400 Subject: [PATCH 51/58] chore: get aws-import example to build in CI --- .gitignore | 1 - examples/typescript/aws-import/tsconfig.json | 33 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 examples/typescript/aws-import/tsconfig.json diff --git a/.gitignore b/.gitignore index c5c218ffbb..d8675980b2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ node_modules .cdk.staging cdktf.out -tsconfig.json **/.DS_Store **/.gen diff --git a/examples/typescript/aws-import/tsconfig.json b/examples/typescript/aws-import/tsconfig.json new file mode 100644 index 0000000000..778b2e42e3 --- /dev/null +++ b/examples/typescript/aws-import/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2018" + ], + "module": "CommonJS", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2018", + "incremental": true + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file From 1446f4e8ebb4311bbbe7c86382aa743788eaa64c Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 22 Sep 2023 11:26:15 -0400 Subject: [PATCH 52/58] chore: disable aws-import example pending upgrade of Terraform version in CI --- examples/typescript/aws-import/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/typescript/aws-import/package.json b/examples/typescript/aws-import/package.json index 810364fda9..f8b49ef474 100644 --- a/examples/typescript/aws-import/package.json +++ b/examples/typescript/aws-import/package.json @@ -1,5 +1,7 @@ { + "//": "This example test is disabled via the 'private' attribute since Terraform 1.5 is required for proper synth, and as of writing CI has a lesser version", "name": "@examples/typescript-aws-import", + "private": true, "version": "0.0.0", "main": "main.js", "types": "main.ts", @@ -27,4 +29,4 @@ "ts-node": "^10.9.1", "typescript": "^5.0.2" } -} +} \ No newline at end of file From 49fb0b9db701344e6d2e7127260fd8ea0e3091fe Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Mon, 25 Sep 2023 12:45:57 -0400 Subject: [PATCH 53/58] chore: rename static method for greater clarity --- examples/typescript/aws-import/main.ts | 2 +- packages/@cdktf/cli-core/src/lib/convert.ts | 9 +-- .../lib/__tests__/provider.test.ts | 2 +- .../complex-computed-types.test.ts.snap | 2 +- .../description-escaping.test.ts.snap | 6 +- .../export-sharding.test.ts.snap | 4 +- .../__snapshots__/nested-types.test.ts.snap | 2 +- .../__snapshots__/provider.test.ts.snap | 4 +- .../__snapshots__/resource-types.test.ts.snap | 8 +-- .../skipped-attributes.test.ts.snap | 2 +- .../__snapshots__/types.test.ts.snap | 60 +++++++++---------- .../get/generator/emitter/resource-emitter.ts | 2 +- 12 files changed, 52 insertions(+), 51 deletions(-) diff --git a/examples/typescript/aws-import/main.ts b/examples/typescript/aws-import/main.ts index 9defc67c50..a76a22da9c 100644 --- a/examples/typescript/aws-import/main.ts +++ b/examples/typescript/aws-import/main.ts @@ -38,7 +38,7 @@ class StackWithImportAndConfigurationGeneration extends TerraformStack { }); // Step 2: Create import block - S3Bucket.importOf(this, "bucket", bucketId); + S3Bucket.importGenerateConfig(this, "bucket", bucketId); // Step 3: Run `cdktf plan` and get the configuration to put in below // Step 4: Remove the `import` call, the resource is now imported diff --git a/packages/@cdktf/cli-core/src/lib/convert.ts b/packages/@cdktf/cli-core/src/lib/convert.ts index af3a7df7ff..0a24c53107 100644 --- a/packages/@cdktf/cli-core/src/lib/convert.ts +++ b/packages/@cdktf/cli-core/src/lib/convert.ts @@ -5,12 +5,13 @@ import * as hcl2cdk from "@cdktf/hcl2cdk"; import { CdktfConfig } from "./cdktf-config"; +import { TerraformProviderConstraint } from "@cdktf/provider-generator"; +import { readSchema } from "@cdktf/provider-schema"; import { + Errors, + LANGUAGES, ConstructsMakerProviderTarget, - TerraformProviderConstraint, - readSchema, -} from "@cdktf/provider-generator"; -import { Errors, LANGUAGES } from "@cdktf/commons"; +} from "@cdktf/commons"; export async function convertConfigurationFile(configuration: string) { const cfg = CdktfConfig.read(process.cwd()); // TODO: make this the project directory instead of cwd diff --git a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts index ed18c25634..b6fe0e55cf 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts @@ -96,7 +96,7 @@ describe("Provider", () => { terraformResourceType = `datadog_${terraformResourceType}`; } expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( - `public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider)` + `public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider)` ); expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( `return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${terraformResourceType}", importId: id, provider });` diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap index 99d459c907..36fe3a1290 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap @@ -214,7 +214,7 @@ export class AcmCertificate extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_acm_certificate", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap index ec5c49346a..81524d50ce 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap @@ -37,7 +37,7 @@ export class DescriptionEscaping extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "description_escaping", importId: id, provider }); } @@ -132,7 +132,7 @@ export class CodeBlocks extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); } @@ -225,7 +225,7 @@ export class CodeBlocks extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap index 4c74f9b89a..c21831228b 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap @@ -110,7 +110,7 @@ export class Dashboard extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "datadog_dashboard", importId: id, provider }); } @@ -146871,7 +146871,7 @@ export class Wafv2WebAcl extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_wafv2_web_acl", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap index f64e89d49e..12151e7fc7 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap @@ -303,7 +303,7 @@ export class NestedTypesResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "nested_types_resource", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap index 3b8322aa0f..d61157b064 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap @@ -1173,7 +1173,7 @@ export class AwsProvider extends cdktf.TerraformProvider { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws", importId: id, provider }); } @@ -1697,7 +1697,7 @@ export class ElasticstackProvider extends cdktf.TerraformProvider { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "elasticstack", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap index 31a89ea286..b8d4a540d2 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap @@ -4023,7 +4023,7 @@ export class CloudfrontDistribution extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_cloudfront_distribution", importId: id, provider }); } @@ -4515,7 +4515,7 @@ export class FmsAdminAccount extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_fms_admin_account", importId: id, provider }); } @@ -7536,7 +7536,7 @@ export class S3Bucket extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_s3_bucket", importId: id, provider }); } @@ -8805,7 +8805,7 @@ export class SecurityGroup extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_security_group", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap index b609531776..c413260aee 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap @@ -691,7 +691,7 @@ export class QuicksightTemplate extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_quicksight_template", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap index 1a798e3c51..d5cce8d29e 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap @@ -33,7 +33,7 @@ export class BooleanList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_list", importId: id, provider }); } @@ -152,7 +152,7 @@ export class BooleanMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_map", importId: id, provider }); } @@ -370,7 +370,7 @@ export class ComputedComplex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex", importId: id, provider }); } @@ -582,7 +582,7 @@ export class ComputedComplexNested extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex_nested", importId: id, provider }); } @@ -840,7 +840,7 @@ export class BlockTypeNestedComputedList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_nested_computed_list", importId: id, provider }); } @@ -1247,7 +1247,7 @@ export class ComputedOptionalComplex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_optional_complex", importId: id, provider }); } @@ -1534,7 +1534,7 @@ export class DeeplyNestedBlockTypes extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_deeply_nested_block_types", importId: id, provider }); } @@ -1631,7 +1631,7 @@ export class IgnoredAttributes extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_ignored_attributes", importId: id, provider }); } @@ -1746,7 +1746,7 @@ export class IncompatibleAttributeNames extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_incompatible_attribute_names", importId: id, provider }); } @@ -1900,7 +1900,7 @@ export class FunctionResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_function", importId: id, provider }); } @@ -2018,7 +2018,7 @@ export class LicenseResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_license", importId: id, provider }); } @@ -2112,7 +2112,7 @@ export class ObjectResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_object", importId: id, provider }); } @@ -2206,7 +2206,7 @@ export class ProviderResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_provider", importId: id, provider }); } @@ -2300,7 +2300,7 @@ export class StaticResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_static", importId: id, provider }); } @@ -2394,7 +2394,7 @@ export class StringResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_string", importId: id, provider }); } @@ -2836,7 +2836,7 @@ export class Complex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_complex", importId: id, provider }); } @@ -3047,7 +3047,7 @@ export class DataAirbyteSourceSchemaCatalog extends cdktf.TerraformDataSource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "airbyte_source_schema_catalog", importId: id, provider }); } @@ -3149,7 +3149,7 @@ export class ListOfStringMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_list_of_string_map", importId: id, provider }); } @@ -3251,7 +3251,7 @@ export class MapOfStringList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_map_of_string_list", importId: id, provider }); } @@ -3355,7 +3355,7 @@ export class NumberList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_list", importId: id, provider }); } @@ -3468,7 +3468,7 @@ export class NumberMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_map", importId: id, provider }); } @@ -3594,7 +3594,7 @@ export class PrimitiveBoolean extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_boolean", importId: id, provider }); } @@ -3734,7 +3734,7 @@ export class PrimitiveDynamic extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_dynamic", importId: id, provider }); } @@ -3875,7 +3875,7 @@ export class PrimitiveNumber extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_number", importId: id, provider }); } @@ -4015,7 +4015,7 @@ export class PrimitiveString extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_string", importId: id, provider }); } @@ -4159,7 +4159,7 @@ export class NameConflict extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_name_conflict", importId: id, provider }); } @@ -4509,7 +4509,7 @@ export class BlockTypeSetList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_set_list", importId: id, provider }); } @@ -4698,7 +4698,7 @@ export class SingleBlockType extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_single_block_type", importId: id, provider }); } @@ -4800,7 +4800,7 @@ export class StringList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_list", importId: id, provider }); } @@ -4940,7 +4940,7 @@ export class StringMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_map", importId: id, provider }); } diff --git a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts index 4988afcd5c..c61f3fb4aa 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts @@ -57,7 +57,7 @@ export class ResourceEmitter { private emitStaticMethods(resource: ResourceModel) { this.code.line( - `public static importOf(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { + `public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${resource.terraformResourceType}", importId: id, provider }); }` ); From 2c2812dec8d2297dfaf76437e5936d0555ea97b1 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Mon, 25 Sep 2023 19:40:45 -0400 Subject: [PATCH 54/58] chore: add escaped attribute for importFrom --- .../lib/get/generator/models/attribute-model.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts b/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts index 1b457eb387..94c49e8360 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts @@ -47,6 +47,8 @@ export function escapeAttributeName(name: string) { if (name === "system") return "systemAttribute"; // `tfResourceType` is already used by resources to distinguish between different resource types if (name === "tfResourceType") return `${name}Attribute`; + // `importFrom` has potential for common name collision with providers + if (name === "importFrom") return `${name}Provider`; return name; } From 0858a654ac8ee0a36a63ddfcc42adfd4aa4d8756 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Tue, 26 Sep 2023 18:56:51 -0400 Subject: [PATCH 55/58] chore: integrated feedback from ansgar, made clear workflow for config generation, updated docs --- examples/typescript/aws-import/main.ts | 2 +- .../@cdktf/cli-core/src/lib/cdktf-stack.ts | 17 +- packages/@cdktf/cli-core/src/lib/convert.ts | 7 +- .../cli-core/src/lib/models/terraform-cli.ts | 24 +- .../__snapshots__/provider.test.ts.snap | 910 ++++++++++++++++++ .../lib/__tests__/provider.test.ts | 6 +- .../complex-computed-types.test.ts.snap | 11 +- .../description-escaping.test.ts.snap | 33 +- .../export-sharding.test.ts.snap | 22 +- .../__snapshots__/nested-types.test.ts.snap | 11 +- .../__snapshots__/provider.test.ts.snap | 22 +- .../__snapshots__/resource-types.test.ts.snap | 44 +- .../skipped-attributes.test.ts.snap | 11 +- .../__snapshots__/types.test.ts.snap | 330 +++++-- .../get/generator/emitter/resource-emitter.ts | 19 +- .../get/generator/models/attribute-model.ts | 2 +- packages/cdktf/lib/importable-resource.ts | 3 - packages/cdktf/lib/terraform-resource.ts | 14 +- packages/cdktf/test/resource.test.ts | 1 - website/docs/cdktf/concepts/resources.mdx | 24 +- 20 files changed, 1387 insertions(+), 126 deletions(-) diff --git a/examples/typescript/aws-import/main.ts b/examples/typescript/aws-import/main.ts index a76a22da9c..0acd11f887 100644 --- a/examples/typescript/aws-import/main.ts +++ b/examples/typescript/aws-import/main.ts @@ -38,7 +38,7 @@ class StackWithImportAndConfigurationGeneration extends TerraformStack { }); // Step 2: Create import block - S3Bucket.importGenerateConfig(this, "bucket", bucketId); + S3Bucket.generateConfigForImport(this, "bucket", bucketId); // Step 3: Run `cdktf plan` and get the configuration to put in below // Step 4: Remove the `import` call, the resource is now imported diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts b/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts index 38ea7b90b7..b555a40445 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts @@ -8,7 +8,8 @@ import { extractJsonLogIfPresent } from "./server/terraform-logs"; import { TerraformCli, OutputFilter, - findGeneratedConfigurationFile, + tryReadGeneratedConfigurationFile, + tryRemoveGeneratedConfigurationFile, } from "./models/terraform-cli"; import { ProviderConstraint } from "./dependencies/dependency-manager"; import { terraformJsonSchema, TerraformStack } from "./terraform-json"; @@ -379,7 +380,7 @@ export class CdktfStack { this.updateState({ type: "planned", stackName: this.stack.name }); // Find generated file - const configFile = await findGeneratedConfigurationFile( + const configFile = await tryReadGeneratedConfigurationFile( this.stack.workingDirectory ); if (configFile) { @@ -389,7 +390,10 @@ export class CdktfStack { configuration: configFile, }); - const convertedCode = await convertConfigurationFile(configFile); + const convertedCode = await convertConfigurationFile( + configFile, + this.stack.workingDirectory + ); this.updateState({ type: "import with configuration converted", stackName: this.stack.name, @@ -406,10 +410,15 @@ CDKTF has translated the code to the following: ${convertedCode} Please review the code and make any necessary changes before adding it to your codebase. -Make sure to only copy the code within the construct's constructor.`, +Make sure to only copy the code within the construct's constructor. + +NOTE: Your resource has not yet become managed by CDKTF. +To finish the import remove the call "generateConfigForImport", add the above code within the construct's constructor, and then append the call importFrom({resource_id_to_import_from}) to the generated code. +`, isError: false, }); } + await tryRemoveGeneratedConfigurationFile(this.stack.workingDirectory); } }); } diff --git a/packages/@cdktf/cli-core/src/lib/convert.ts b/packages/@cdktf/cli-core/src/lib/convert.ts index 0a24c53107..4ffcb5375f 100644 --- a/packages/@cdktf/cli-core/src/lib/convert.ts +++ b/packages/@cdktf/cli-core/src/lib/convert.ts @@ -13,8 +13,11 @@ import { ConstructsMakerProviderTarget, } from "@cdktf/commons"; -export async function convertConfigurationFile(configuration: string) { - const cfg = CdktfConfig.read(process.cwd()); // TODO: make this the project directory instead of cwd +export async function convertConfigurationFile( + configuration: string, + stackWorkingDirectory: string +) { + const cfg = CdktfConfig.read(stackWorkingDirectory); // TODO: make this the project directory instead of cwd const targets = cfg.terraformProviders.map((constraint) => ConstructsMakerProviderTarget.from( new TerraformProviderConstraint(constraint), diff --git a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts index 5a99ebbcbe..fbb2e4f8ef 100644 --- a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts +++ b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts @@ -81,6 +81,7 @@ class VariableRequiredFilter extends AbstractOutputFilter { export class TerraformCli implements Terraform { public readonly workdir: string; + static readonly generatedImportConfigFile: string = "generated_resources.tf"; private readonly onStdout: ( stateName: string, filter?: OutputFilter[] @@ -228,13 +229,15 @@ export class TerraformCli implements Terraform { const generatedConfigFile = path.join( this.workdir, - "generated_resources.tf" + TerraformCli.generatedImportConfigFile ); if (fs.existsSync(generatedConfigFile)) { fs.remove(generatedConfigFile); } if (this.hasImports) { - options.push("-generate-config-out=generated_resources.tf"); + options.push( + `-generate-config-out=${TerraformCli.generatedImportConfigFile}` + ); } if (!this.isCloudStack) { const planFile = "plan"; @@ -485,12 +488,25 @@ export class TerraformCli implements Terraform { } } -export async function findGeneratedConfigurationFile( +export async function tryReadGeneratedConfigurationFile( workingDir: string ): Promise { - const generatedConfigPath = path.join(workingDir, "generated_resources.tf"); + const generatedConfigPath = path.join( + workingDir, + TerraformCli.generatedImportConfigFile + ); if (!fs.existsSync(generatedConfigPath)) { return null; } return fs.readFileSync(generatedConfigPath, "utf-8"); } + +export async function tryRemoveGeneratedConfigurationFile(workingDir: string) { + const generatedConfigPath = path.join( + workingDir, + TerraformCli.generatedImportConfigFile + ); + if (fs.existsSync(generatedConfigPath)) { + fs.unlinkSync(generatedConfigPath); + } +} diff --git a/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap index 37f352f773..8f35940954 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap @@ -45,6 +45,20 @@ export class ApiKey extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_api_key"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_api_key to import to, as it appears in generated config + * @param importFormId The id of the datadog_api_key in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_api_key to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_api_key", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -164,6 +178,20 @@ export class ApplicationKey extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_application_key"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_application_key to import to, as it appears in generated config + * @param importFormId The id of the datadog_application_key in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_application_key to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_application_key", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -295,6 +323,20 @@ export class AuthnMapping extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_authn_mapping"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_authn_mapping to import to, as it appears in generated config + * @param importFormId The id of the datadog_authn_mapping in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_authn_mapping to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_authn_mapping", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -1030,6 +1072,20 @@ export class ChildOrganization extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_child_organization"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_child_organization to import to, as it appears in generated config + * @param importFormId The id of the datadog_child_organization in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_child_organization to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_child_organization", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -1196,6 +1252,20 @@ export class CloudWorkloadSecurityAgentRule extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_cloud_workload_security_agent_rule"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_cloud_workload_security_agent_rule to import to, as it appears in generated config + * @param importFormId The id of the datadog_cloud_workload_security_agent_rule in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_cloud_workload_security_agent_rule to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_cloud_workload_security_agent_rule", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -1373,6 +1443,20 @@ export class DashboardJson extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_dashboard_json"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_dashboard_json to import to, as it appears in generated config + * @param importFormId The id of the datadog_dashboard_json in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_dashboard_json to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard_json", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -1656,6 +1740,20 @@ export class DashboardList extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_dashboard_list"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_dashboard_list to import to, as it appears in generated config + * @param importFormId The id of the datadog_dashboard_list in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_dashboard_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard_list", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -172993,6 +173091,20 @@ export class Dashboard extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_dashboard"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_dashboard to import to, as it appears in generated config + * @param importFormId The id of the datadog_dashboard in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_dashboard to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -173309,6 +173421,20 @@ export class DataDatadogApiKey extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_api_key"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_api_key to import to, as it appears in generated config + * @param importFormId The id of the datadog_api_key in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_api_key to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_api_key", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -173433,6 +173559,20 @@ export class DataDatadogApplicationKey extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_application_key"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_application_key to import to, as it appears in generated config + * @param importFormId The id of the datadog_application_key in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_application_key to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_application_key", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -173633,6 +173773,20 @@ export class DataDatadogCloudWorkloadSecurityAgentRules extends cdktf.TerraformD // ================= public static readonly tfResourceType = "datadog_cloud_workload_security_agent_rules"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_cloud_workload_security_agent_rules to import to, as it appears in generated config + * @param importFormId The id of the datadog_cloud_workload_security_agent_rules in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_cloud_workload_security_agent_rules to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_cloud_workload_security_agent_rules", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -173738,6 +173892,20 @@ export class DataDatadogDashboardList extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_dashboard_list"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_dashboard_list to import to, as it appears in generated config + * @param importFormId The id of the datadog_dashboard_list in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_dashboard_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard_list", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -173852,6 +174020,20 @@ export class DataDatadogDashboard extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_dashboard"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_dashboard to import to, as it appears in generated config + * @param importFormId The id of the datadog_dashboard in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_dashboard to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -173970,6 +174152,20 @@ export class DataDatadogIpRanges extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_ip_ranges"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_ip_ranges to import to, as it appears in generated config + * @param importFormId The id of the datadog_ip_ranges in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_ip_ranges to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_ip_ranges", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -174145,6 +174341,20 @@ export class DataDatadogLogsIndexesOrder extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_logs_indexes_order"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_indexes_order to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_indexes_order in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_indexes_order to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_indexes_order", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -174537,6 +174747,20 @@ export class DataDatadogLogsIndexes extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_logs_indexes"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_indexes to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_indexes in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_indexes to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_indexes", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -174812,6 +175036,20 @@ export class DataDatadogMonitor extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_monitor"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_monitor to import to, as it appears in generated config + * @param importFormId The id of the datadog_monitor in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_monitor to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitor", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -175173,6 +175411,20 @@ export class DataDatadogMonitors extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_monitors"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_monitors to import to, as it appears in generated config + * @param importFormId The id of the datadog_monitors in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_monitors to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitors", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -175326,6 +175578,20 @@ export class DataDatadogPermissions extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_permissions"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_permissions to import to, as it appears in generated config + * @param importFormId The id of the datadog_permissions in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_permissions to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_permissions", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -175431,6 +175697,20 @@ export class DataDatadogRole extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_role"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_role to import to, as it appears in generated config + * @param importFormId The id of the datadog_role in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_role to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_role", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -175629,6 +175909,20 @@ export class DataDatadogRoles extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_roles"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_roles to import to, as it appears in generated config + * @param importFormId The id of the datadog_roles in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_roles to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_roles", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -175905,6 +176199,20 @@ export class DataDatadogSecurityMonitoringFilters extends cdktf.TerraformDataSou // ================= public static readonly tfResourceType = "datadog_security_monitoring_filters"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_security_monitoring_filters to import to, as it appears in generated config + * @param importFormId The id of the datadog_security_monitoring_filters in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_security_monitoring_filters to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_filters", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -176682,6 +176990,20 @@ export class DataDatadogSecurityMonitoringRules extends cdktf.TerraformDataSourc // ================= public static readonly tfResourceType = "datadog_security_monitoring_rules"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_security_monitoring_rules to import to, as it appears in generated config + * @param importFormId The id of the datadog_security_monitoring_rules in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_security_monitoring_rules to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_rules", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -176878,6 +177200,20 @@ export class DataDatadogServiceLevelObjective extends cdktf.TerraformDataSource // ================= public static readonly tfResourceType = "datadog_service_level_objective"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_service_level_objective to import to, as it appears in generated config + * @param importFormId The id of the datadog_service_level_objective in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_service_level_objective to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_service_level_objective", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -177133,6 +177469,20 @@ export class DataDatadogServiceLevelObjectives extends cdktf.TerraformDataSource // ================= public static readonly tfResourceType = "datadog_service_level_objectives"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_service_level_objectives to import to, as it appears in generated config + * @param importFormId The id of the datadog_service_level_objectives in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_service_level_objectives to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_service_level_objectives", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -177310,6 +177660,20 @@ export class DataDatadogSyntheticsGlobalVariable extends cdktf.TerraformDataSour // ================= public static readonly tfResourceType = "datadog_synthetics_global_variable"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_synthetics_global_variable to import to, as it appears in generated config + * @param importFormId The id of the datadog_synthetics_global_variable in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_synthetics_global_variable to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_global_variable", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -177423,6 +177787,20 @@ export class DataDatadogSyntheticsLocations extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_synthetics_locations"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_synthetics_locations to import to, as it appears in generated config + * @param importFormId The id of the datadog_synthetics_locations in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_synthetics_locations to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_locations", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -177528,6 +177906,20 @@ export class DataDatadogSyntheticsTest extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_synthetics_test"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_synthetics_test to import to, as it appears in generated config + * @param importFormId The id of the datadog_synthetics_test in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_synthetics_test to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_test", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -177657,6 +178049,20 @@ export class DataDatadogUser extends cdktf.TerraformDataSource { // ================= public static readonly tfResourceType = "datadog_user"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_user to import to, as it appears in generated config + * @param importFormId The id of the datadog_user in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_user to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_user", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -178050,6 +178456,20 @@ export class Downtime extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_downtime"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_downtime to import to, as it appears in generated config + * @param importFormId The id of the datadog_downtime in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_downtime to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_downtime", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -178433,6 +178853,20 @@ export class IntegrationAwsLambdaArn extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_aws_lambda_arn"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_aws_lambda_arn to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_aws_lambda_arn in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_aws_lambda_arn to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws_lambda_arn", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -178568,6 +179002,20 @@ export class IntegrationAwsLogCollection extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_aws_log_collection"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_aws_log_collection to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_aws_log_collection in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_aws_log_collection to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws_log_collection", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -178709,6 +179157,20 @@ export class IntegrationAwsTagFilter extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_aws_tag_filter"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_aws_tag_filter to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_aws_tag_filter in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_aws_tag_filter to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws_tag_filter", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -178913,6 +179375,20 @@ export class IntegrationAws extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_aws"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_aws to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_aws in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_aws to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -179239,6 +179715,20 @@ export class IntegrationAzure extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_azure"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_azure to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_azure in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_azure to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_azure", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -179455,6 +179945,20 @@ export class IntegrationGcp extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_gcp"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_gcp to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_gcp in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_gcp to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_gcp", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -179671,6 +180175,20 @@ export class IntegrationPagerdutyServiceObject extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_pagerduty_service_object"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_pagerduty_service_object to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_pagerduty_service_object in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_pagerduty_service_object to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_pagerduty_service_object", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -179812,6 +180330,20 @@ export class IntegrationPagerduty extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_pagerduty"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_pagerduty to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_pagerduty in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_pagerduty to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_pagerduty", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -180128,6 +180660,20 @@ export class IntegrationSlackChannel extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_integration_slack_channel"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_integration_slack_channel to import to, as it appears in generated config + * @param importFormId The id of the datadog_integration_slack_channel in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_integration_slack_channel to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_slack_channel", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -180340,6 +180886,20 @@ export class LogsArchiveOrder extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_archive_order"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_archive_order to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_archive_order in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_archive_order to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_archive_order", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -180954,6 +181514,20 @@ export class LogsArchive extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_archive"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_archive to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_archive in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_archive to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_archive", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -187632,6 +188206,20 @@ export class LogsCustomPipeline extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_custom_pipeline"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_custom_pipeline to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_custom_pipeline in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_custom_pipeline to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_custom_pipeline", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -187803,6 +188391,20 @@ export class LogsIndexOrder extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_index_order"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_index_order to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_index_order in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_index_order to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_index_order", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -188311,6 +188913,20 @@ export class LogsIndex extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_index"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_index to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_index in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_index to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_index", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -188512,6 +189128,20 @@ export class LogsIntegrationPipeline extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_integration_pipeline"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_integration_pipeline to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_integration_pipeline in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_integration_pipeline to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_integration_pipeline", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -188926,6 +189556,20 @@ export class LogsMetric extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_metric"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_metric to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_metric in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_metric to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_metric", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -189094,6 +189738,20 @@ export class LogsPipelineOrder extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_logs_pipeline_order"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_logs_pipeline_order to import to, as it appears in generated config + * @param importFormId The id of the datadog_logs_pipeline_order in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_logs_pipeline_order to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_pipeline_order", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -189259,6 +189917,20 @@ export class MetricMetadata extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_metric_metadata"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_metric_metadata to import to, as it appears in generated config + * @param importFormId The id of the datadog_metric_metadata in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_metric_metadata to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_metric_metadata", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -189627,6 +190299,20 @@ export class MetricTagConfiguration extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_metric_tag_configuration"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_metric_tag_configuration to import to, as it appears in generated config + * @param importFormId The id of the datadog_metric_tag_configuration in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_metric_tag_configuration to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_metric_tag_configuration", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -189813,6 +190499,20 @@ export class MonitorJson extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_monitor_json"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_monitor_json to import to, as it appears in generated config + * @param importFormId The id of the datadog_monitor_json in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_monitor_json to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitor_json", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -190421,6 +191121,20 @@ export class Monitor extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_monitor"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_monitor to import to, as it appears in generated config + * @param importFormId The id of the datadog_monitor in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_monitor to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitor", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -191517,6 +192231,20 @@ export class OrganizationSettings extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_organization_settings"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_organization_settings to import to, as it appears in generated config + * @param importFormId The id of the datadog_organization_settings in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_organization_settings to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_organization_settings", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -191691,6 +192419,20 @@ export class DatadogProvider extends cdktf.TerraformProvider { // ================= public static readonly tfResourceType = "datadog"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog to import to, as it appears in generated config + * @param importFormId The id of the datadog in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -192002,6 +192744,20 @@ export class Role extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_role"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_role to import to, as it appears in generated config + * @param importFormId The id of the datadog_role in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_role to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_role", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -192395,6 +193151,20 @@ export class SecurityMonitoringDefaultRule extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_security_monitoring_default_rule"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_security_monitoring_default_rule to import to, as it appears in generated config + * @param importFormId The id of the datadog_security_monitoring_default_rule in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_security_monitoring_default_rule to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_default_rule", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -192694,6 +193464,20 @@ export class SecurityMonitoringFilter extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_security_monitoring_filter"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_security_monitoring_filter to import to, as it appears in generated config + * @param importFormId The id of the datadog_security_monitoring_filter in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_security_monitoring_filter to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_filter", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -193993,6 +194777,20 @@ export class SecurityMonitoringRule extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_security_monitoring_rule"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_security_monitoring_rule to import to, as it appears in generated config + * @param importFormId The id of the datadog_security_monitoring_rule in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_security_monitoring_rule to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_rule", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -194565,6 +195363,20 @@ export class ServiceLevelObjective extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_service_level_objective"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_service_level_objective to import to, as it appears in generated config + * @param importFormId The id of the datadog_service_level_objective in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_service_level_objective to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_service_level_objective", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -194877,6 +195689,20 @@ export class SloCorrection extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_slo_correction"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_slo_correction to import to, as it appears in generated config + * @param importFormId The id of the datadog_slo_correction in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_slo_correction to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_slo_correction", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -195365,6 +196191,20 @@ export class SyntheticsGlobalVariable extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_synthetics_global_variable"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_synthetics_global_variable to import to, as it appears in generated config + * @param importFormId The id of the datadog_synthetics_global_variable in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_synthetics_global_variable to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_global_variable", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -195687,6 +196527,20 @@ export class SyntheticsPrivateLocation extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_synthetics_private_location"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_synthetics_private_location to import to, as it appears in generated config + * @param importFormId The id of the datadog_synthetics_private_location in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_synthetics_private_location to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_private_location", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -201846,6 +202700,20 @@ export class SyntheticsTest extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_synthetics_test"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_synthetics_test to import to, as it appears in generated config + * @param importFormId The id of the datadog_synthetics_test in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_synthetics_test to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_test", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -202340,6 +203208,20 @@ export class User extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_user"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_user to import to, as it appears in generated config + * @param importFormId The id of the datadog_user in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_user to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_user", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -202548,6 +203430,20 @@ export class WebhookCustomVariable extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_webhook_custom_variable"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_webhook_custom_variable to import to, as it appears in generated config + * @param importFormId The id of the datadog_webhook_custom_variable in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_webhook_custom_variable to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_webhook_custom_variable", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== @@ -202716,6 +203612,20 @@ export class Webhook extends cdktf.TerraformResource { // ================= public static readonly tfResourceType = "datadog_webhook"; + // ============== + // STATIC Methods + // ============== + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_webhook to import to, as it appears in generated config + * @param importFormId The id of the datadog_webhook in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_webhook to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_webhook", importId: importFromId, provider }); + } + // =========== // INITIALIZER // =========== diff --git a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts index b6fe0e55cf..060039533c 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts +++ b/packages/@cdktf/provider-generator/lib/__tests__/provider.test.ts @@ -62,7 +62,7 @@ describe("Provider", () => { expect(snapshot).toMatchSnapshot(); }); }, 600_000), - it.only("has generated provider that includes static import functions", async () => { + it("has generated provider that includes static import functions", async () => { const constraint = new TerraformProviderConstraint( "DataDog/datadog@= 3.12.0" ); @@ -96,10 +96,10 @@ describe("Provider", () => { terraformResourceType = `datadog_${terraformResourceType}`; } expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( - `public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider)` + `public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) {` ); expect(snapshot[`providers/datadog/${resource}/index.ts`]).toContain( - `return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${terraformResourceType}", importId: id, provider });` + `return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "${terraformResourceType}", importId: importFromId, provider });` ); }); }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap index 36fe3a1290..e59b04edd5 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap @@ -214,8 +214,15 @@ export class AcmCertificate extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_acm_certificate", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_acm_certificate to import to, as it appears in generated config + * @param importFormId The id of the aws_acm_certificate in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_acm_certificate to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_acm_certificate", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap index 81524d50ce..283c9e723f 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap @@ -37,8 +37,15 @@ export class DescriptionEscaping extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "description_escaping", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the description_escaping to import to, as it appears in generated config + * @param importFormId The id of the description_escaping in the cloud provider to generate config of + * @param provider? Instance of the provider where description_escaping to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "description_escaping", importId: importFromId, provider }); } // =========== @@ -132,8 +139,15 @@ export class CodeBlocks extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the code_blocks to import to, as it appears in generated config + * @param importFormId The id of the code_blocks in the cloud provider to generate config of + * @param provider? Instance of the provider where code_blocks to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "code_blocks", importId: importFromId, provider }); } // =========== @@ -225,8 +239,15 @@ export class CodeBlocks extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "code_blocks", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the code_blocks to import to, as it appears in generated config + * @param importFormId The id of the code_blocks in the cloud provider to generate config of + * @param provider? Instance of the provider where code_blocks to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "code_blocks", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap index c21831228b..2e82bed3a1 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap @@ -110,8 +110,15 @@ export class Dashboard extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "datadog_dashboard", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the datadog_dashboard to import to, as it appears in generated config + * @param importFormId The id of the datadog_dashboard in the cloud provider to generate config of + * @param provider? Instance of the provider where datadog_dashboard to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard", importId: importFromId, provider }); } // =========== @@ -146871,8 +146878,15 @@ export class Wafv2WebAcl extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_wafv2_web_acl", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_wafv2_web_acl to import to, as it appears in generated config + * @param importFormId The id of the aws_wafv2_web_acl in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_wafv2_web_acl to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_wafv2_web_acl", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap index 12151e7fc7..bbfe0cfd13 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap @@ -303,8 +303,15 @@ export class NestedTypesResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "nested_types_resource", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the nested_types_resource to import to, as it appears in generated config + * @param importFormId The id of the nested_types_resource in the cloud provider to generate config of + * @param provider? Instance of the provider where nested_types_resource to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "nested_types_resource", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap index d61157b064..242f8d6b01 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap @@ -1173,8 +1173,15 @@ export class AwsProvider extends cdktf.TerraformProvider { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws to import to, as it appears in generated config + * @param importFormId The id of the aws in the cloud provider to generate config of + * @param provider? Instance of the provider where aws to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws", importId: importFromId, provider }); } // =========== @@ -1697,8 +1704,15 @@ export class ElasticstackProvider extends cdktf.TerraformProvider { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "elasticstack", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the elasticstack to import to, as it appears in generated config + * @param importFormId The id of the elasticstack in the cloud provider to generate config of + * @param provider? Instance of the provider where elasticstack to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "elasticstack", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap index b8d4a540d2..3de33b1606 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap @@ -4023,8 +4023,15 @@ export class CloudfrontDistribution extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_cloudfront_distribution", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_cloudfront_distribution to import to, as it appears in generated config + * @param importFormId The id of the aws_cloudfront_distribution in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_cloudfront_distribution to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_cloudfront_distribution", importId: importFromId, provider }); } // =========== @@ -4515,8 +4522,15 @@ export class FmsAdminAccount extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_fms_admin_account", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_fms_admin_account to import to, as it appears in generated config + * @param importFormId The id of the aws_fms_admin_account in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_fms_admin_account to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_fms_admin_account", importId: importFromId, provider }); } // =========== @@ -7536,8 +7550,15 @@ export class S3Bucket extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_s3_bucket", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_s3_bucket to import to, as it appears in generated config + * @param importFormId The id of the aws_s3_bucket in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_s3_bucket to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_s3_bucket", importId: importFromId, provider }); } // =========== @@ -8805,8 +8826,15 @@ export class SecurityGroup extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_security_group", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_security_group to import to, as it appears in generated config + * @param importFormId The id of the aws_security_group in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_security_group to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_security_group", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap index c413260aee..d6b6196753 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap @@ -691,8 +691,15 @@ export class QuicksightTemplate extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_quicksight_template", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_quicksight_template to import to, as it appears in generated config + * @param importFormId The id of the aws_quicksight_template in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_quicksight_template to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_quicksight_template", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap index d5cce8d29e..f091d6cdd9 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap @@ -33,8 +33,15 @@ export class BooleanList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_list", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_boolean_list to import to, as it appears in generated config + * @param importFormId The id of the aws_boolean_list in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_boolean_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_boolean_list", importId: importFromId, provider }); } // =========== @@ -152,8 +159,15 @@ export class BooleanMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_boolean_map", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_boolean_map to import to, as it appears in generated config + * @param importFormId The id of the aws_boolean_map in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_boolean_map to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_boolean_map", importId: importFromId, provider }); } // =========== @@ -370,8 +384,15 @@ export class ComputedComplex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_computed_complex to import to, as it appears in generated config + * @param importFormId The id of the aws_computed_complex in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_computed_complex to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_computed_complex", importId: importFromId, provider }); } // =========== @@ -582,8 +603,15 @@ export class ComputedComplexNested extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_complex_nested", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_computed_complex_nested to import to, as it appears in generated config + * @param importFormId The id of the aws_computed_complex_nested in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_computed_complex_nested to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_computed_complex_nested", importId: importFromId, provider }); } // =========== @@ -840,8 +868,15 @@ export class BlockTypeNestedComputedList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_nested_computed_list", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_block_type_nested_computed_list to import to, as it appears in generated config + * @param importFormId The id of the aws_block_type_nested_computed_list in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_block_type_nested_computed_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_block_type_nested_computed_list", importId: importFromId, provider }); } // =========== @@ -1247,8 +1282,15 @@ export class ComputedOptionalComplex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_computed_optional_complex", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_computed_optional_complex to import to, as it appears in generated config + * @param importFormId The id of the aws_computed_optional_complex in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_computed_optional_complex to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_computed_optional_complex", importId: importFromId, provider }); } // =========== @@ -1534,8 +1576,15 @@ export class DeeplyNestedBlockTypes extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_deeply_nested_block_types", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_deeply_nested_block_types to import to, as it appears in generated config + * @param importFormId The id of the aws_deeply_nested_block_types in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_deeply_nested_block_types to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_deeply_nested_block_types", importId: importFromId, provider }); } // =========== @@ -1631,8 +1680,15 @@ export class IgnoredAttributes extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_ignored_attributes", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_ignored_attributes to import to, as it appears in generated config + * @param importFormId The id of the aws_ignored_attributes in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_ignored_attributes to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_ignored_attributes", importId: importFromId, provider }); } // =========== @@ -1746,8 +1802,15 @@ export class IncompatibleAttributeNames extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_incompatible_attribute_names", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_incompatible_attribute_names to import to, as it appears in generated config + * @param importFormId The id of the aws_incompatible_attribute_names in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_incompatible_attribute_names to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_incompatible_attribute_names", importId: importFromId, provider }); } // =========== @@ -1900,8 +1963,15 @@ export class FunctionResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_function", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_function to import to, as it appears in generated config + * @param importFormId The id of the test_function in the cloud provider to generate config of + * @param provider? Instance of the provider where test_function to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_function", importId: importFromId, provider }); } // =========== @@ -2018,8 +2088,15 @@ export class LicenseResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_license", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_license to import to, as it appears in generated config + * @param importFormId The id of the test_license in the cloud provider to generate config of + * @param provider? Instance of the provider where test_license to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_license", importId: importFromId, provider }); } // =========== @@ -2112,8 +2189,15 @@ export class ObjectResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_object", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_object to import to, as it appears in generated config + * @param importFormId The id of the test_object in the cloud provider to generate config of + * @param provider? Instance of the provider where test_object to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_object", importId: importFromId, provider }); } // =========== @@ -2206,8 +2290,15 @@ export class ProviderResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_provider", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_provider to import to, as it appears in generated config + * @param importFormId The id of the test_provider in the cloud provider to generate config of + * @param provider? Instance of the provider where test_provider to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_provider", importId: importFromId, provider }); } // =========== @@ -2300,8 +2391,15 @@ export class StaticResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_static", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_static to import to, as it appears in generated config + * @param importFormId The id of the test_static in the cloud provider to generate config of + * @param provider? Instance of the provider where test_static to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_static", importId: importFromId, provider }); } // =========== @@ -2394,8 +2492,15 @@ export class StringResource extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_string", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_string to import to, as it appears in generated config + * @param importFormId The id of the test_string in the cloud provider to generate config of + * @param provider? Instance of the provider where test_string to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_string", importId: importFromId, provider }); } // =========== @@ -2836,8 +2941,15 @@ export class Complex extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "test_complex", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the test_complex to import to, as it appears in generated config + * @param importFormId The id of the test_complex in the cloud provider to generate config of + * @param provider? Instance of the provider where test_complex to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_complex", importId: importFromId, provider }); } // =========== @@ -3047,8 +3159,15 @@ export class DataAirbyteSourceSchemaCatalog extends cdktf.TerraformDataSource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "airbyte_source_schema_catalog", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the airbyte_source_schema_catalog to import to, as it appears in generated config + * @param importFormId The id of the airbyte_source_schema_catalog in the cloud provider to generate config of + * @param provider? Instance of the provider where airbyte_source_schema_catalog to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "airbyte_source_schema_catalog", importId: importFromId, provider }); } // =========== @@ -3149,8 +3268,15 @@ export class ListOfStringMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_list_of_string_map", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_list_of_string_map to import to, as it appears in generated config + * @param importFormId The id of the aws_list_of_string_map in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_list_of_string_map to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_list_of_string_map", importId: importFromId, provider }); } // =========== @@ -3251,8 +3377,15 @@ export class MapOfStringList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_map_of_string_list", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_map_of_string_list to import to, as it appears in generated config + * @param importFormId The id of the aws_map_of_string_list in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_map_of_string_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_map_of_string_list", importId: importFromId, provider }); } // =========== @@ -3355,8 +3488,15 @@ export class NumberList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_list", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_number_list to import to, as it appears in generated config + * @param importFormId The id of the aws_number_list in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_number_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_number_list", importId: importFromId, provider }); } // =========== @@ -3468,8 +3608,15 @@ export class NumberMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_number_map", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_number_map to import to, as it appears in generated config + * @param importFormId The id of the aws_number_map in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_number_map to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_number_map", importId: importFromId, provider }); } // =========== @@ -3594,8 +3741,15 @@ export class PrimitiveBoolean extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_boolean", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_primitive_boolean to import to, as it appears in generated config + * @param importFormId The id of the aws_primitive_boolean in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_primitive_boolean to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_boolean", importId: importFromId, provider }); } // =========== @@ -3734,8 +3888,15 @@ export class PrimitiveDynamic extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_dynamic", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_primitive_dynamic to import to, as it appears in generated config + * @param importFormId The id of the aws_primitive_dynamic in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_primitive_dynamic to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_dynamic", importId: importFromId, provider }); } // =========== @@ -3875,8 +4036,15 @@ export class PrimitiveNumber extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_number", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_primitive_number to import to, as it appears in generated config + * @param importFormId The id of the aws_primitive_number in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_primitive_number to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_number", importId: importFromId, provider }); } // =========== @@ -4015,8 +4183,15 @@ export class PrimitiveString extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_primitive_string", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_primitive_string to import to, as it appears in generated config + * @param importFormId The id of the aws_primitive_string in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_primitive_string to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_string", importId: importFromId, provider }); } // =========== @@ -4159,8 +4334,15 @@ export class NameConflict extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_name_conflict", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_name_conflict to import to, as it appears in generated config + * @param importFormId The id of the aws_name_conflict in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_name_conflict to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_name_conflict", importId: importFromId, provider }); } // =========== @@ -4509,8 +4691,15 @@ export class BlockTypeSetList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_block_type_set_list", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_block_type_set_list to import to, as it appears in generated config + * @param importFormId The id of the aws_block_type_set_list in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_block_type_set_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_block_type_set_list", importId: importFromId, provider }); } // =========== @@ -4698,8 +4887,15 @@ export class SingleBlockType extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_single_block_type", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_single_block_type to import to, as it appears in generated config + * @param importFormId The id of the aws_single_block_type in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_single_block_type to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_single_block_type", importId: importFromId, provider }); } // =========== @@ -4800,8 +4996,15 @@ export class StringList extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_list", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_string_list to import to, as it appears in generated config + * @param importFormId The id of the aws_string_list in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_string_list to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_string_list", importId: importFromId, provider }); } // =========== @@ -4940,8 +5143,15 @@ export class StringMap extends cdktf.TerraformResource { // ============== // STATIC Methods // ============== - public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "aws_string_map", importId: id, provider }); + /** + * For generation of configuration for import, run "cdktf plan " + * @param scope The scope in which to define this construct + * @param importToId The id of the aws_string_map to import to, as it appears in generated config + * @param importFormId The id of the aws_string_map in the cloud provider to generate config of + * @param provider? Instance of the provider where aws_string_map to import is found + */ + public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_string_map", importId: importFromId, provider }); } // =========== diff --git a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts index c61f3fb4aa..258e0dda4d 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts @@ -56,9 +56,24 @@ export class ResourceEmitter { } private emitStaticMethods(resource: ResourceModel) { + const comment = sanitizedComment(this.code); + comment.line( + `For generation of configuration for import, run "cdktf plan "` + ); + comment.line(`@param scope The scope in which to define this construct`); + comment.line( + `@param importToId The id of the ${resource.terraformResourceType} to import to, as it appears in generated config` + ); + comment.line( + `@param importFormId The id of the ${resource.terraformResourceType} in the cloud provider to generate config of` + ); + comment.line( + `@param provider? Instance of the provider where ${resource.terraformResourceType} to import is found` + ); + comment.end(); this.code.line( - `public static importGenerateConfig(scope: Construct, name: string, id: string, provider?: cdktf.TerraformProvider) { - return new cdktf.ImportableResource(scope, name, { terraformResourceType: "${resource.terraformResourceType}", importId: id, provider }); + `public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { + return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "${resource.terraformResourceType}", importId: importFromId, provider }); }` ); } diff --git a/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts b/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts index 94c49e8360..009927150e 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/models/attribute-model.ts @@ -48,7 +48,7 @@ export function escapeAttributeName(name: string) { // `tfResourceType` is already used by resources to distinguish between different resource types if (name === "tfResourceType") return `${name}Attribute`; // `importFrom` has potential for common name collision with providers - if (name === "importFrom") return `${name}Provider`; + if (name === "importFrom") return `${name}Attribute`; return name; } diff --git a/packages/cdktf/lib/importable-resource.ts b/packages/cdktf/lib/importable-resource.ts index 41ff99323a..e350b63b7d 100644 --- a/packages/cdktf/lib/importable-resource.ts +++ b/packages/cdktf/lib/importable-resource.ts @@ -32,9 +32,6 @@ export class ImportableResource extends TerraformElement { ); } - /** - * Adds this resource to the terraform JSON output. - */ public toTerraform(): any { const expectedResourceAddress = `${this.config.terraformResourceType}.${this.friendlyUniqueId}`; return { diff --git a/packages/cdktf/lib/terraform-resource.ts b/packages/cdktf/lib/terraform-resource.ts index bdde1de498..e81b01b414 100644 --- a/packages/cdktf/lib/terraform-resource.ts +++ b/packages/cdktf/lib/terraform-resource.ts @@ -96,7 +96,7 @@ export class TerraformResource public provisioners?: Array< FileProvisioner | LocalExecProvisioner | RemoteExecProvisioner >; - public imported?: TerraformResourceImport; + private _imported?: TerraformResourceImport; constructor(scope: Construct, id: string, config: TerraformResourceConfig) { super(scope, id, config.terraformResourceType); @@ -210,11 +210,11 @@ export class TerraformResource }; return { - import: this.imported + import: this._imported ? [ { - provider: this.imported.provider?.fqn, - id: this.imported.id, + provider: this._imported.provider?.fqn, + id: this._imported.id, to: `${this.terraformResourceType}.${this.friendlyUniqueId}`, }, ] @@ -234,7 +234,7 @@ export class TerraformResource [this.terraformResourceType]: Object.keys(this.rawOverrides), } : undefined, - imports: this.imported + imports: this._imported ? { [this.terraformResourceType]: [this.friendlyUniqueId], } @@ -252,7 +252,7 @@ export class TerraformResource } public importFrom(id: string, provider?: TerraformProvider) { - this.imported = { id, provider }; + this._imported = { id, provider }; this.node.addValidation( new ValidateTerraformVersion( ">=1.5", @@ -261,6 +261,6 @@ export class TerraformResource ); } public resetImport() { - this.imported = undefined; + this._imported = undefined; } } diff --git a/packages/cdktf/test/resource.test.ts b/packages/cdktf/test/resource.test.ts index 4b5bb9dc2f..38d12c134d 100644 --- a/packages/cdktf/test/resource.test.ts +++ b/packages/cdktf/test/resource.test.ts @@ -341,6 +341,5 @@ test("includes import block when import is present, provider given", () => { new TestResource(stack, "test", { name: "foo", }).importFrom("testId", provider); - console.log("stack with provider", Testing.synth(stack)); expect(Testing.synth(stack)).toMatchSnapshot(); }); diff --git a/website/docs/cdktf/concepts/resources.mdx b/website/docs/cdktf/concepts/resources.mdx index e159e4c40b..d8185a4b47 100644 --- a/website/docs/cdktf/concepts/resources.mdx +++ b/website/docs/cdktf/concepts/resources.mdx @@ -383,18 +383,19 @@ To add one configure the `lifecycle` key on your resource with an object contain ## Importing Resources -If you have existing resources that you want to manage with CDKTF, you can import them into your CDKTF application. The best way to do this is using the [`import` block feature](/terraform/language/import) of Terraform >= 1.5. You can do this in CDKTF either with a specified configuration or without, which will trigger the configuration generation. +If you have existing resources that you want to manage with CDKTF, you can import them into your CDKTF application. The best way to do this is using the [`import` block feature](/terraform/language/import) of Terraform >= 1.5. You can do this in CDKTF either with a specified configuration or without. -### Importing with Configuration +### How To Import -To import a resource with configuration, you write your resource configuration as you would normally. Then you call the `importFrom` method on the resulting resource object. This method takes the resource ID as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. +To import a resource, first instantiate an instance of the resource type you wish to import– in our case we'll be using a S3Bucket. No configuration is expilictly needed. You then call the `importFrom` method on the resource object. This method takes the ID of the resource to be imported as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. ```typescript new S3Bucket(this, "bucket", {}).importFrom(bucketId); ``` -When running plan / apply you will get the information that one resource is going to be imported. Once you ran apply you can remove the `importFrom` call and the resource will be managed by CDKTF. -The output might look like this: +When running plan / apply you will get the information that your resource is going to be imported. Once you have ran apply, you can remove the `importFrom` call and the resource will become managed by CDKTF. + +Your output might look as follows: ``` ts-import Initializing the backend... @@ -471,16 +472,17 @@ ts-import # aws_s3_bucket.bucket (bucket) will be updated in-place terraform apply "plan" ``` -### Importing without Configuration +### Generate Configuration For Import -If you want to import a resource without specifying the configuration you can use the instance method `import` on the class of the resource you want to import. This method takes the scope as the first argument, the construct name within the CDKTF program as the second, resource ID as the third argument and the provider as an optional fourth. The provider is only required if you have multiple providers of the same type in your configuration. +If you want to specify the configuration of your imported resource you can use the static method `generateConfigForImport` on the class of the resource you want to import. This method takes the scope as the first argument, the resource ID of the resource to import to (as will be given in the generated config returned), the resource ID of the resource to be imported, and the provider as an optional fourth. The provider is only required if you have multiple providers of the same type in your configuration. ```typescript -S3Bucket.import(this, "bucket", bucketId); +S3Bucket.generateConfigForImport(this, "bucket", bucketId); ``` -When running plan / apply you will get the information that one resource is going to be imported. Once you ran plan / apply, CDKTF CLI will return the CDKTF construct. You can use this in your CDKTF application after the the apply and therefore the import is done and replace the `S3Bucket.import` call. -The output might look like this: +When running `cdktf plan ` you will get the information that resource(s) is/are going to be imported, followed by the configuration of your import(s) in CDKTF specific terms. + +Your output might look as follows: ``` ts-import-with-configuration Initializing the backend... @@ -611,6 +613,8 @@ ts-import-with-configuration Import without configuration detected. Terraform h Make sure to only copy the code within the construct's constructor. ``` +Though at this point, your resource(s) has/have not been imported. To import, first add the new generated configuration to your project, then remove the initial call of `generateConfigForImport`. Finally, add the call `importFrom` as it is done in the section "How To Import" above. On apply, your resource(s) will be imported, then becoming managed by CDKTF. + ## Escape Hatch Terraform provides [meta-arguments](/terraform/language/resources/syntax#meta-arguments) to change resource behavior. For example, the `for_each` meta-argument creates multiple resource instances according to a map, or set of strings. The escape hatch allows you to use these meta-arguments to your CDKTF application and to override attributes that CDKTF cannot yet fully express. From bff66884a8a3b1ab050d582d0386f95234b2b042 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 27 Sep 2023 09:20:22 -0400 Subject: [PATCH 56/58] chore: update docs/doc-strings with feedback from ansgar --- examples/typescript/aws-import/main.ts | 6 ++- .../@cdktf/cli-core/src/lib/cdktf-stack.ts | 4 +- packages/@cdktf/cli-core/src/lib/convert.ts | 2 +- .../cli-core/src/lib/models/terraform-cli.ts | 19 +++---- .../get/generator/emitter/resource-emitter.ts | 8 +-- packages/cdktf/lib/terraform-resource.ts | 3 -- website/docs/cdktf/concepts/resources.mdx | 53 +++++++++---------- 7 files changed, 42 insertions(+), 53 deletions(-) diff --git a/examples/typescript/aws-import/main.ts b/examples/typescript/aws-import/main.ts index 0acd11f887..6c48a3e357 100644 --- a/examples/typescript/aws-import/main.ts +++ b/examples/typescript/aws-import/main.ts @@ -40,8 +40,10 @@ class StackWithImportAndConfigurationGeneration extends TerraformStack { // Step 2: Create import block S3Bucket.generateConfigForImport(this, "bucket", bucketId); - // Step 3: Run `cdktf plan` and get the configuration to put in below - // Step 4: Remove the `import` call, the resource is now imported + // Step 3: Run cdktf plan + // Step 4: Replace the `generateConfigForImport()` call with the generated configuration + // Step 5: Add the `importFrom` call to the generated configuration, + // Step 6: On apply, the resource is now imported } } diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts b/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts index b555a40445..0f9fc7bf1c 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-stack.ts @@ -413,7 +413,9 @@ Please review the code and make any necessary changes before adding it to your c Make sure to only copy the code within the construct's constructor. NOTE: Your resource has not yet become managed by CDKTF. -To finish the import remove the call "generateConfigForImport", add the above code within the construct's constructor, and then append the call importFrom({resource_id_to_import_from}) to the generated code. +To finish the import remove the call "generateConfigForImport", add the above code within the construct's constructor, and then append the call importFrom() to the generated code: + +new SomeResource(...).importFrom("some_id") `, isError: false, }); diff --git a/packages/@cdktf/cli-core/src/lib/convert.ts b/packages/@cdktf/cli-core/src/lib/convert.ts index 4ffcb5375f..14e43954b7 100644 --- a/packages/@cdktf/cli-core/src/lib/convert.ts +++ b/packages/@cdktf/cli-core/src/lib/convert.ts @@ -17,7 +17,7 @@ export async function convertConfigurationFile( configuration: string, stackWorkingDirectory: string ) { - const cfg = CdktfConfig.read(stackWorkingDirectory); // TODO: make this the project directory instead of cwd + const cfg = CdktfConfig.read(stackWorkingDirectory); const targets = cfg.terraformProviders.map((constraint) => ConstructsMakerProviderTarget.from( new TerraformProviderConstraint(constraint), diff --git a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts index fbb2e4f8ef..8438e6c9a6 100644 --- a/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts +++ b/packages/@cdktf/cli-core/src/lib/models/terraform-cli.ts @@ -29,6 +29,8 @@ import { spawnPty } from "./pty-process"; import path from "path"; import * as fs from "fs-extra"; +const GENERATE_CONFIG_OUT_FILE = "generated_resources.tf"; + export class TerraformCliPlan extends AbstractTerraformPlan implements TerraformPlan @@ -81,7 +83,6 @@ class VariableRequiredFilter extends AbstractOutputFilter { export class TerraformCli implements Terraform { public readonly workdir: string; - static readonly generatedImportConfigFile: string = "generated_resources.tf"; private readonly onStdout: ( stateName: string, filter?: OutputFilter[] @@ -229,15 +230,13 @@ export class TerraformCli implements Terraform { const generatedConfigFile = path.join( this.workdir, - TerraformCli.generatedImportConfigFile + GENERATE_CONFIG_OUT_FILE ); if (fs.existsSync(generatedConfigFile)) { fs.remove(generatedConfigFile); } if (this.hasImports) { - options.push( - `-generate-config-out=${TerraformCli.generatedImportConfigFile}` - ); + options.push(`-generate-config-out=${GENERATE_CONFIG_OUT_FILE}`); } if (!this.isCloudStack) { const planFile = "plan"; @@ -491,10 +490,7 @@ export class TerraformCli implements Terraform { export async function tryReadGeneratedConfigurationFile( workingDir: string ): Promise { - const generatedConfigPath = path.join( - workingDir, - TerraformCli.generatedImportConfigFile - ); + const generatedConfigPath = path.join(workingDir, GENERATE_CONFIG_OUT_FILE); if (!fs.existsSync(generatedConfigPath)) { return null; } @@ -502,10 +498,7 @@ export async function tryReadGeneratedConfigurationFile( } export async function tryRemoveGeneratedConfigurationFile(workingDir: string) { - const generatedConfigPath = path.join( - workingDir, - TerraformCli.generatedImportConfigFile - ); + const generatedConfigPath = path.join(workingDir, GENERATE_CONFIG_OUT_FILE); if (fs.existsSync(generatedConfigPath)) { fs.unlinkSync(generatedConfigPath); } diff --git a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts index 258e0dda4d..506eb69f4b 100644 --- a/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts +++ b/packages/@cdktf/provider-generator/lib/get/generator/emitter/resource-emitter.ts @@ -58,17 +58,17 @@ export class ResourceEmitter { private emitStaticMethods(resource: ResourceModel) { const comment = sanitizedComment(this.code); comment.line( - `For generation of configuration for import, run "cdktf plan "` + `Generates CDKTF code for importing a ${resource.className} resource upon running "cdktf plan "` ); comment.line(`@param scope The scope in which to define this construct`); comment.line( - `@param importToId The id of the ${resource.terraformResourceType} to import to, as it appears in generated config` + `@param importToId The construct id used in the generated config for the ${resource.className} to import` ); comment.line( - `@param importFormId The id of the ${resource.terraformResourceType} in the cloud provider to generate config of` + `@param importFromId The id of the existing ${resource.className} that should be imported. Refer to the {@link ${resource.linkToDocs}#import import section} in the documentation of this resource for the id to use` ); comment.line( - `@param provider? Instance of the provider where ${resource.terraformResourceType} to import is found` + `@param provider? Optional instance of the provider where the ${resource.className} to import is found` ); comment.end(); this.code.line( diff --git a/packages/cdktf/lib/terraform-resource.ts b/packages/cdktf/lib/terraform-resource.ts index e81b01b414..38b8979c5b 100644 --- a/packages/cdktf/lib/terraform-resource.ts +++ b/packages/cdktf/lib/terraform-resource.ts @@ -260,7 +260,4 @@ export class TerraformResource ) ); } - public resetImport() { - this._imported = undefined; - } } diff --git a/website/docs/cdktf/concepts/resources.mdx b/website/docs/cdktf/concepts/resources.mdx index d8185a4b47..683ecf32c9 100644 --- a/website/docs/cdktf/concepts/resources.mdx +++ b/website/docs/cdktf/concepts/resources.mdx @@ -387,7 +387,7 @@ If you have existing resources that you want to manage with CDKTF, you can impor ### How To Import -To import a resource, first instantiate an instance of the resource type you wish to import– in our case we'll be using a S3Bucket. No configuration is expilictly needed. You then call the `importFrom` method on the resource object. This method takes the ID of the resource to be imported as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. +To import a resource, first instantiate an instance of the resource type you wish to import– in our case we'll be using an S3Bucket. No configuration is explicitly needed. You then call the `importFrom` method on the resource object. This method takes the ID of the resource to be imported as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. ```typescript new S3Bucket(this, "bucket", {}).importFrom(bucketId); @@ -395,6 +395,8 @@ new S3Bucket(this, "bucket", {}).importFrom(bucketId); When running plan / apply you will get the information that your resource is going to be imported. Once you have ran apply, you can remove the `importFrom` call and the resource will become managed by CDKTF. +Please note that Terraform is going to update existing fields on the imported resource to match your configuration as it puts it under management. In our case we did not define any specific properties on the `S3Bucket` which causes Terraform e.g. to remove the tags currently defined on the resource (as can be seen on the plan below). If you want to keep existing settings, you can run a plan first, add everything that Terraform would change to your resource config, and only then apply the changes. + Your output might look as follows: ``` @@ -474,13 +476,13 @@ ts-import # aws_s3_bucket.bucket (bucket) will be updated in-place ### Generate Configuration For Import -If you want to specify the configuration of your imported resource you can use the static method `generateConfigForImport` on the class of the resource you want to import. This method takes the scope as the first argument, the resource ID of the resource to import to (as will be given in the generated config returned), the resource ID of the resource to be imported, and the provider as an optional fourth. The provider is only required if you have multiple providers of the same type in your configuration. +If you don't want to specify the configuration of your imported resource yourself you can use the static method `generateConfigForImport` on the class of the resource you want to import. This method takes the scope as the first argument, the construct id of the resource to import to (as will be given in the generated config returned), the resource id of the resource to be imported, and the provider as an optional fourth. The provider is only required if you have multiple providers of the same type in your configuration. ```typescript S3Bucket.generateConfigForImport(this, "bucket", bucketId); ``` -When running `cdktf plan ` you will get the information that resource(s) is/are going to be imported, followed by the configuration of your import(s) in CDKTF specific terms. +When running `cdktf plan ` Terraform will generate code for the resource you are importing and CDKTF will convert it to the language you are using. Your output might look as follows: @@ -488,9 +490,10 @@ Your output might look as follows: ts-import-with-configuration Initializing the backend... ts-import-with-configuration Initializing provider plugins... - Reusing previous version of hashicorp/aws from the dependency lock file -ts-import-with-configuration - Using previously-installed hashicorp/aws v5.5.0 -ts-import-with-configuration Terraform has been successfully initialized! +ts-import-with-configuration - Using previously-installed hashicorp/aws v5.18.1 + Terraform has been successfully initialized! +ts-import-with-configuration You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. @@ -508,20 +511,16 @@ ts-import-with-configuration # aws_s3_bucket.bucket will be imported bucket = "best-bucket-in-the-world" bucket_domain_name = "best-bucket-in-the-world.s3.amazonaws.com" bucket_regional_domain_name = "best-bucket-in-the-world.s3.us-east-1.amazonaws.com" - hosted_zone_id = "XXXXXXXXXXXXX" + hosted_zone_id = "Z3AQBSTGFYJSTF" id = "best-bucket-in-the-world" object_lock_enabled = false region = "us-east-1" request_payer = "BucketOwner" - tags = { - "foo" = "bar" - } - tags_all = { - "foo" = "bar" - } + tags = {} + tags_all = {} grant { - id = "XXXXXXXXXXXXX" + id = "554912fda2704333d162d216be50aefb05562e0bf1709997f1d9417cf46087d5" permissions = [ "FULL_CONTROL", ] @@ -539,14 +538,13 @@ ts-import-with-configuration # aws_s3_bucket.bucket will be imported } versioning { - enabled = true + enabled = false mfa_delete = false } } Plan: 1 to import, 0 to add, 0 to change, 0 to destroy. - -ts-import-with-configuration â•· + â•· │ Warning: Config generation is experimental │ │ Generating configuration during import is currently experimental, and the @@ -573,12 +571,8 @@ ts-import-with-configuration Import without configuration detected. Terraform h bucket_prefix = null force_destroy = null object_lock_enabled = false - tags = { - foo = "bar" - } - tags_all = { - foo = "bar" - } + tags = {} + tags_all = {} } @@ -598,12 +592,8 @@ ts-import-with-configuration Import without configuration detected. Terraform h bucketPrefix: [null], forceDestroy: [null], objectLockEnabled: false, - tags: { - foo: "bar", - }, - tagsAll: { - foo: "bar", - }, + tags: {}, + tagsAll: {}, }); } } @@ -611,9 +601,14 @@ ts-import-with-configuration Import without configuration detected. Terraform h Please review the code and make any necessary changes before adding it to your codebase. Make sure to only copy the code within the construct's constructor. + + NOTE: Your resource has not yet become managed by CDKTF. + To finish the import remove the call "generateConfigForImport", add the above code within the construct's constructor, and then append the call importFrom() to the generated code: + + new SomeResource(...).importFrom("some_id") ``` -Though at this point, your resource(s) has/have not been imported. To import, first add the new generated configuration to your project, then remove the initial call of `generateConfigForImport`. Finally, add the call `importFrom` as it is done in the section "How To Import" above. On apply, your resource(s) will be imported, then becoming managed by CDKTF. +Though at this point, your resource has not been imported. To import, first add the new generated configuration to your project, then remove the initial call of `generateConfigForImport`. Finally, follow the steps outlined in the section "How To Import" above. On apply, your resource will be imported, then becoming managed by CDKTF. ## Escape Hatch From 78b6b67ef598bf21bba2ba723657ff6812c47dc1 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 27 Sep 2023 09:33:51 -0400 Subject: [PATCH 57/58] chore: update snapshots --- .../__snapshots__/provider.test.ts.snap | 520 +++++++++--------- .../complex-computed-types.test.ts.snap | 8 +- .../description-escaping.test.ts.snap | 24 +- .../export-sharding.test.ts.snap | 16 +- .../__snapshots__/nested-types.test.ts.snap | 8 +- .../__snapshots__/provider.test.ts.snap | 16 +- .../__snapshots__/resource-types.test.ts.snap | 32 +- .../skipped-attributes.test.ts.snap | 8 +- .../__snapshots__/types.test.ts.snap | 240 ++++---- 9 files changed, 436 insertions(+), 436 deletions(-) diff --git a/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap index 8f35940954..badb5182b1 100644 --- a/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/__tests__/__snapshots__/provider.test.ts.snap @@ -49,11 +49,11 @@ export class ApiKey extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ApiKey resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_api_key to import to, as it appears in generated config - * @param importFormId The id of the datadog_api_key in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_api_key to import is found + * @param importToId The construct id used in the generated config for the ApiKey to import + * @param importFromId The id of the existing ApiKey that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/api_key#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ApiKey to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_api_key", importId: importFromId, provider }); @@ -182,11 +182,11 @@ export class ApplicationKey extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ApplicationKey resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_application_key to import to, as it appears in generated config - * @param importFormId The id of the datadog_application_key in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_application_key to import is found + * @param importToId The construct id used in the generated config for the ApplicationKey to import + * @param importFromId The id of the existing ApplicationKey that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/application_key#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ApplicationKey to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_application_key", importId: importFromId, provider }); @@ -327,11 +327,11 @@ export class AuthnMapping extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a AuthnMapping resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_authn_mapping to import to, as it appears in generated config - * @param importFormId The id of the datadog_authn_mapping in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_authn_mapping to import is found + * @param importToId The construct id used in the generated config for the AuthnMapping to import + * @param importFromId The id of the existing AuthnMapping that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/authn_mapping#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the AuthnMapping to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_authn_mapping", importId: importFromId, provider }); @@ -1076,11 +1076,11 @@ export class ChildOrganization extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ChildOrganization resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_child_organization to import to, as it appears in generated config - * @param importFormId The id of the datadog_child_organization in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_child_organization to import is found + * @param importToId The construct id used in the generated config for the ChildOrganization to import + * @param importFromId The id of the existing ChildOrganization that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/child_organization#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ChildOrganization to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_child_organization", importId: importFromId, provider }); @@ -1256,11 +1256,11 @@ export class CloudWorkloadSecurityAgentRule extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a CloudWorkloadSecurityAgentRule resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_cloud_workload_security_agent_rule to import to, as it appears in generated config - * @param importFormId The id of the datadog_cloud_workload_security_agent_rule in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_cloud_workload_security_agent_rule to import is found + * @param importToId The construct id used in the generated config for the CloudWorkloadSecurityAgentRule to import + * @param importFromId The id of the existing CloudWorkloadSecurityAgentRule that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/cloud_workload_security_agent_rule#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the CloudWorkloadSecurityAgentRule to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_cloud_workload_security_agent_rule", importId: importFromId, provider }); @@ -1447,11 +1447,11 @@ export class DashboardJson extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DashboardJson resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_dashboard_json to import to, as it appears in generated config - * @param importFormId The id of the datadog_dashboard_json in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_dashboard_json to import is found + * @param importToId The construct id used in the generated config for the DashboardJson to import + * @param importFromId The id of the existing DashboardJson that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/dashboard_json#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DashboardJson to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard_json", importId: importFromId, provider }); @@ -1744,11 +1744,11 @@ export class DashboardList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DashboardList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_dashboard_list to import to, as it appears in generated config - * @param importFormId The id of the datadog_dashboard_list in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_dashboard_list to import is found + * @param importToId The construct id used in the generated config for the DashboardList to import + * @param importFromId The id of the existing DashboardList that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/dashboard_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DashboardList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard_list", importId: importFromId, provider }); @@ -173095,11 +173095,11 @@ export class Dashboard extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Dashboard resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_dashboard to import to, as it appears in generated config - * @param importFormId The id of the datadog_dashboard in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_dashboard to import is found + * @param importToId The construct id used in the generated config for the Dashboard to import + * @param importFromId The id of the existing Dashboard that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/dashboard#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Dashboard to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard", importId: importFromId, provider }); @@ -173425,11 +173425,11 @@ export class DataDatadogApiKey extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogApiKey resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_api_key to import to, as it appears in generated config - * @param importFormId The id of the datadog_api_key in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_api_key to import is found + * @param importToId The construct id used in the generated config for the DataDatadogApiKey to import + * @param importFromId The id of the existing DataDatadogApiKey that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/api_key#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogApiKey to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_api_key", importId: importFromId, provider }); @@ -173563,11 +173563,11 @@ export class DataDatadogApplicationKey extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogApplicationKey resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_application_key to import to, as it appears in generated config - * @param importFormId The id of the datadog_application_key in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_application_key to import is found + * @param importToId The construct id used in the generated config for the DataDatadogApplicationKey to import + * @param importFromId The id of the existing DataDatadogApplicationKey that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/application_key#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogApplicationKey to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_application_key", importId: importFromId, provider }); @@ -173777,11 +173777,11 @@ export class DataDatadogCloudWorkloadSecurityAgentRules extends cdktf.TerraformD // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogCloudWorkloadSecurityAgentRules resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_cloud_workload_security_agent_rules to import to, as it appears in generated config - * @param importFormId The id of the datadog_cloud_workload_security_agent_rules in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_cloud_workload_security_agent_rules to import is found + * @param importToId The construct id used in the generated config for the DataDatadogCloudWorkloadSecurityAgentRules to import + * @param importFromId The id of the existing DataDatadogCloudWorkloadSecurityAgentRules that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/cloud_workload_security_agent_rules#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogCloudWorkloadSecurityAgentRules to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_cloud_workload_security_agent_rules", importId: importFromId, provider }); @@ -173896,11 +173896,11 @@ export class DataDatadogDashboardList extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogDashboardList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_dashboard_list to import to, as it appears in generated config - * @param importFormId The id of the datadog_dashboard_list in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_dashboard_list to import is found + * @param importToId The construct id used in the generated config for the DataDatadogDashboardList to import + * @param importFromId The id of the existing DataDatadogDashboardList that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/dashboard_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogDashboardList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard_list", importId: importFromId, provider }); @@ -174024,11 +174024,11 @@ export class DataDatadogDashboard extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogDashboard resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_dashboard to import to, as it appears in generated config - * @param importFormId The id of the datadog_dashboard in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_dashboard to import is found + * @param importToId The construct id used in the generated config for the DataDatadogDashboard to import + * @param importFromId The id of the existing DataDatadogDashboard that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/dashboard#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogDashboard to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard", importId: importFromId, provider }); @@ -174156,11 +174156,11 @@ export class DataDatadogIpRanges extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogIpRanges resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_ip_ranges to import to, as it appears in generated config - * @param importFormId The id of the datadog_ip_ranges in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_ip_ranges to import is found + * @param importToId The construct id used in the generated config for the DataDatadogIpRanges to import + * @param importFromId The id of the existing DataDatadogIpRanges that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/ip_ranges#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogIpRanges to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_ip_ranges", importId: importFromId, provider }); @@ -174345,11 +174345,11 @@ export class DataDatadogLogsIndexesOrder extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogLogsIndexesOrder resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_indexes_order to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_indexes_order in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_indexes_order to import is found + * @param importToId The construct id used in the generated config for the DataDatadogLogsIndexesOrder to import + * @param importFromId The id of the existing DataDatadogLogsIndexesOrder that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/logs_indexes_order#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogLogsIndexesOrder to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_indexes_order", importId: importFromId, provider }); @@ -174751,11 +174751,11 @@ export class DataDatadogLogsIndexes extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogLogsIndexes resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_indexes to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_indexes in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_indexes to import is found + * @param importToId The construct id used in the generated config for the DataDatadogLogsIndexes to import + * @param importFromId The id of the existing DataDatadogLogsIndexes that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/logs_indexes#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogLogsIndexes to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_indexes", importId: importFromId, provider }); @@ -175040,11 +175040,11 @@ export class DataDatadogMonitor extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogMonitor resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_monitor to import to, as it appears in generated config - * @param importFormId The id of the datadog_monitor in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_monitor to import is found + * @param importToId The construct id used in the generated config for the DataDatadogMonitor to import + * @param importFromId The id of the existing DataDatadogMonitor that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/monitor#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogMonitor to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitor", importId: importFromId, provider }); @@ -175415,11 +175415,11 @@ export class DataDatadogMonitors extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogMonitors resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_monitors to import to, as it appears in generated config - * @param importFormId The id of the datadog_monitors in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_monitors to import is found + * @param importToId The construct id used in the generated config for the DataDatadogMonitors to import + * @param importFromId The id of the existing DataDatadogMonitors that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/monitors#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogMonitors to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitors", importId: importFromId, provider }); @@ -175582,11 +175582,11 @@ export class DataDatadogPermissions extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogPermissions resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_permissions to import to, as it appears in generated config - * @param importFormId The id of the datadog_permissions in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_permissions to import is found + * @param importToId The construct id used in the generated config for the DataDatadogPermissions to import + * @param importFromId The id of the existing DataDatadogPermissions that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/permissions#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogPermissions to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_permissions", importId: importFromId, provider }); @@ -175701,11 +175701,11 @@ export class DataDatadogRole extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogRole resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_role to import to, as it appears in generated config - * @param importFormId The id of the datadog_role in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_role to import is found + * @param importToId The construct id used in the generated config for the DataDatadogRole to import + * @param importFromId The id of the existing DataDatadogRole that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/role#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogRole to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_role", importId: importFromId, provider }); @@ -175913,11 +175913,11 @@ export class DataDatadogRoles extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogRoles resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_roles to import to, as it appears in generated config - * @param importFormId The id of the datadog_roles in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_roles to import is found + * @param importToId The construct id used in the generated config for the DataDatadogRoles to import + * @param importFromId The id of the existing DataDatadogRoles that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/roles#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogRoles to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_roles", importId: importFromId, provider }); @@ -176203,11 +176203,11 @@ export class DataDatadogSecurityMonitoringFilters extends cdktf.TerraformDataSou // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogSecurityMonitoringFilters resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_security_monitoring_filters to import to, as it appears in generated config - * @param importFormId The id of the datadog_security_monitoring_filters in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_security_monitoring_filters to import is found + * @param importToId The construct id used in the generated config for the DataDatadogSecurityMonitoringFilters to import + * @param importFromId The id of the existing DataDatadogSecurityMonitoringFilters that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/security_monitoring_filters#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogSecurityMonitoringFilters to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_filters", importId: importFromId, provider }); @@ -176994,11 +176994,11 @@ export class DataDatadogSecurityMonitoringRules extends cdktf.TerraformDataSourc // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogSecurityMonitoringRules resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_security_monitoring_rules to import to, as it appears in generated config - * @param importFormId The id of the datadog_security_monitoring_rules in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_security_monitoring_rules to import is found + * @param importToId The construct id used in the generated config for the DataDatadogSecurityMonitoringRules to import + * @param importFromId The id of the existing DataDatadogSecurityMonitoringRules that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/security_monitoring_rules#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogSecurityMonitoringRules to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_rules", importId: importFromId, provider }); @@ -177204,11 +177204,11 @@ export class DataDatadogServiceLevelObjective extends cdktf.TerraformDataSource // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogServiceLevelObjective resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_service_level_objective to import to, as it appears in generated config - * @param importFormId The id of the datadog_service_level_objective in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_service_level_objective to import is found + * @param importToId The construct id used in the generated config for the DataDatadogServiceLevelObjective to import + * @param importFromId The id of the existing DataDatadogServiceLevelObjective that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/service_level_objective#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogServiceLevelObjective to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_service_level_objective", importId: importFromId, provider }); @@ -177473,11 +177473,11 @@ export class DataDatadogServiceLevelObjectives extends cdktf.TerraformDataSource // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogServiceLevelObjectives resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_service_level_objectives to import to, as it appears in generated config - * @param importFormId The id of the datadog_service_level_objectives in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_service_level_objectives to import is found + * @param importToId The construct id used in the generated config for the DataDatadogServiceLevelObjectives to import + * @param importFromId The id of the existing DataDatadogServiceLevelObjectives that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/service_level_objectives#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogServiceLevelObjectives to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_service_level_objectives", importId: importFromId, provider }); @@ -177664,11 +177664,11 @@ export class DataDatadogSyntheticsGlobalVariable extends cdktf.TerraformDataSour // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogSyntheticsGlobalVariable resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_synthetics_global_variable to import to, as it appears in generated config - * @param importFormId The id of the datadog_synthetics_global_variable in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_synthetics_global_variable to import is found + * @param importToId The construct id used in the generated config for the DataDatadogSyntheticsGlobalVariable to import + * @param importFromId The id of the existing DataDatadogSyntheticsGlobalVariable that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/synthetics_global_variable#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogSyntheticsGlobalVariable to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_global_variable", importId: importFromId, provider }); @@ -177791,11 +177791,11 @@ export class DataDatadogSyntheticsLocations extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogSyntheticsLocations resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_synthetics_locations to import to, as it appears in generated config - * @param importFormId The id of the datadog_synthetics_locations in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_synthetics_locations to import is found + * @param importToId The construct id used in the generated config for the DataDatadogSyntheticsLocations to import + * @param importFromId The id of the existing DataDatadogSyntheticsLocations that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/synthetics_locations#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogSyntheticsLocations to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_locations", importId: importFromId, provider }); @@ -177910,11 +177910,11 @@ export class DataDatadogSyntheticsTest extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogSyntheticsTest resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_synthetics_test to import to, as it appears in generated config - * @param importFormId The id of the datadog_synthetics_test in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_synthetics_test to import is found + * @param importToId The construct id used in the generated config for the DataDatadogSyntheticsTest to import + * @param importFromId The id of the existing DataDatadogSyntheticsTest that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/synthetics_test#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogSyntheticsTest to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_test", importId: importFromId, provider }); @@ -178053,11 +178053,11 @@ export class DataDatadogUser extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataDatadogUser resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_user to import to, as it appears in generated config - * @param importFormId The id of the datadog_user in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_user to import is found + * @param importToId The construct id used in the generated config for the DataDatadogUser to import + * @param importFromId The id of the existing DataDatadogUser that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/data-sources/user#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataDatadogUser to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_user", importId: importFromId, provider }); @@ -178460,11 +178460,11 @@ export class Downtime extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Downtime resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_downtime to import to, as it appears in generated config - * @param importFormId The id of the datadog_downtime in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_downtime to import is found + * @param importToId The construct id used in the generated config for the Downtime to import + * @param importFromId The id of the existing Downtime that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/downtime#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Downtime to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_downtime", importId: importFromId, provider }); @@ -178857,11 +178857,11 @@ export class IntegrationAwsLambdaArn extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationAwsLambdaArn resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_aws_lambda_arn to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_aws_lambda_arn in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_aws_lambda_arn to import is found + * @param importToId The construct id used in the generated config for the IntegrationAwsLambdaArn to import + * @param importFromId The id of the existing IntegrationAwsLambdaArn that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_aws_lambda_arn#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationAwsLambdaArn to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws_lambda_arn", importId: importFromId, provider }); @@ -179006,11 +179006,11 @@ export class IntegrationAwsLogCollection extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationAwsLogCollection resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_aws_log_collection to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_aws_log_collection in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_aws_log_collection to import is found + * @param importToId The construct id used in the generated config for the IntegrationAwsLogCollection to import + * @param importFromId The id of the existing IntegrationAwsLogCollection that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_aws_log_collection#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationAwsLogCollection to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws_log_collection", importId: importFromId, provider }); @@ -179161,11 +179161,11 @@ export class IntegrationAwsTagFilter extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationAwsTagFilter resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_aws_tag_filter to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_aws_tag_filter in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_aws_tag_filter to import is found + * @param importToId The construct id used in the generated config for the IntegrationAwsTagFilter to import + * @param importFromId The id of the existing IntegrationAwsTagFilter that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_aws_tag_filter#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationAwsTagFilter to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws_tag_filter", importId: importFromId, provider }); @@ -179379,11 +179379,11 @@ export class IntegrationAws extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationAws resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_aws to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_aws in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_aws to import is found + * @param importToId The construct id used in the generated config for the IntegrationAws to import + * @param importFromId The id of the existing IntegrationAws that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_aws#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationAws to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_aws", importId: importFromId, provider }); @@ -179719,11 +179719,11 @@ export class IntegrationAzure extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationAzure resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_azure to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_azure in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_azure to import is found + * @param importToId The construct id used in the generated config for the IntegrationAzure to import + * @param importFromId The id of the existing IntegrationAzure that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_azure#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationAzure to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_azure", importId: importFromId, provider }); @@ -179949,11 +179949,11 @@ export class IntegrationGcp extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationGcp resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_gcp to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_gcp in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_gcp to import is found + * @param importToId The construct id used in the generated config for the IntegrationGcp to import + * @param importFromId The id of the existing IntegrationGcp that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_gcp#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationGcp to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_gcp", importId: importFromId, provider }); @@ -180179,11 +180179,11 @@ export class IntegrationPagerdutyServiceObject extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationPagerdutyServiceObject resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_pagerduty_service_object to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_pagerduty_service_object in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_pagerduty_service_object to import is found + * @param importToId The construct id used in the generated config for the IntegrationPagerdutyServiceObject to import + * @param importFromId The id of the existing IntegrationPagerdutyServiceObject that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_pagerduty_service_object#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationPagerdutyServiceObject to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_pagerduty_service_object", importId: importFromId, provider }); @@ -180334,11 +180334,11 @@ export class IntegrationPagerduty extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationPagerduty resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_pagerduty to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_pagerduty in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_pagerduty to import is found + * @param importToId The construct id used in the generated config for the IntegrationPagerduty to import + * @param importFromId The id of the existing IntegrationPagerduty that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_pagerduty#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationPagerduty to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_pagerduty", importId: importFromId, provider }); @@ -180664,11 +180664,11 @@ export class IntegrationSlackChannel extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IntegrationSlackChannel resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_integration_slack_channel to import to, as it appears in generated config - * @param importFormId The id of the datadog_integration_slack_channel in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_integration_slack_channel to import is found + * @param importToId The construct id used in the generated config for the IntegrationSlackChannel to import + * @param importFromId The id of the existing IntegrationSlackChannel that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/integration_slack_channel#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IntegrationSlackChannel to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_integration_slack_channel", importId: importFromId, provider }); @@ -180890,11 +180890,11 @@ export class LogsArchiveOrder extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsArchiveOrder resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_archive_order to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_archive_order in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_archive_order to import is found + * @param importToId The construct id used in the generated config for the LogsArchiveOrder to import + * @param importFromId The id of the existing LogsArchiveOrder that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_archive_order#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsArchiveOrder to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_archive_order", importId: importFromId, provider }); @@ -181518,11 +181518,11 @@ export class LogsArchive extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsArchive resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_archive to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_archive in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_archive to import is found + * @param importToId The construct id used in the generated config for the LogsArchive to import + * @param importFromId The id of the existing LogsArchive that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_archive#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsArchive to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_archive", importId: importFromId, provider }); @@ -188210,11 +188210,11 @@ export class LogsCustomPipeline extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsCustomPipeline resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_custom_pipeline to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_custom_pipeline in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_custom_pipeline to import is found + * @param importToId The construct id used in the generated config for the LogsCustomPipeline to import + * @param importFromId The id of the existing LogsCustomPipeline that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_custom_pipeline#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsCustomPipeline to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_custom_pipeline", importId: importFromId, provider }); @@ -188395,11 +188395,11 @@ export class LogsIndexOrder extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsIndexOrder resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_index_order to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_index_order in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_index_order to import is found + * @param importToId The construct id used in the generated config for the LogsIndexOrder to import + * @param importFromId The id of the existing LogsIndexOrder that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_index_order#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsIndexOrder to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_index_order", importId: importFromId, provider }); @@ -188917,11 +188917,11 @@ export class LogsIndex extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsIndex resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_index to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_index in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_index to import is found + * @param importToId The construct id used in the generated config for the LogsIndex to import + * @param importFromId The id of the existing LogsIndex that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_index#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsIndex to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_index", importId: importFromId, provider }); @@ -189132,11 +189132,11 @@ export class LogsIntegrationPipeline extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsIntegrationPipeline resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_integration_pipeline to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_integration_pipeline in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_integration_pipeline to import is found + * @param importToId The construct id used in the generated config for the LogsIntegrationPipeline to import + * @param importFromId The id of the existing LogsIntegrationPipeline that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_integration_pipeline#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsIntegrationPipeline to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_integration_pipeline", importId: importFromId, provider }); @@ -189560,11 +189560,11 @@ export class LogsMetric extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsMetric resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_metric to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_metric in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_metric to import is found + * @param importToId The construct id used in the generated config for the LogsMetric to import + * @param importFromId The id of the existing LogsMetric that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_metric#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsMetric to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_metric", importId: importFromId, provider }); @@ -189742,11 +189742,11 @@ export class LogsPipelineOrder extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LogsPipelineOrder resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_logs_pipeline_order to import to, as it appears in generated config - * @param importFormId The id of the datadog_logs_pipeline_order in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_logs_pipeline_order to import is found + * @param importToId The construct id used in the generated config for the LogsPipelineOrder to import + * @param importFromId The id of the existing LogsPipelineOrder that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/logs_pipeline_order#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LogsPipelineOrder to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_logs_pipeline_order", importId: importFromId, provider }); @@ -189921,11 +189921,11 @@ export class MetricMetadata extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a MetricMetadata resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_metric_metadata to import to, as it appears in generated config - * @param importFormId The id of the datadog_metric_metadata in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_metric_metadata to import is found + * @param importToId The construct id used in the generated config for the MetricMetadata to import + * @param importFromId The id of the existing MetricMetadata that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/metric_metadata#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the MetricMetadata to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_metric_metadata", importId: importFromId, provider }); @@ -190303,11 +190303,11 @@ export class MetricTagConfiguration extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a MetricTagConfiguration resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_metric_tag_configuration to import to, as it appears in generated config - * @param importFormId The id of the datadog_metric_tag_configuration in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_metric_tag_configuration to import is found + * @param importToId The construct id used in the generated config for the MetricTagConfiguration to import + * @param importFromId The id of the existing MetricTagConfiguration that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/metric_tag_configuration#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the MetricTagConfiguration to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_metric_tag_configuration", importId: importFromId, provider }); @@ -190503,11 +190503,11 @@ export class MonitorJson extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a MonitorJson resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_monitor_json to import to, as it appears in generated config - * @param importFormId The id of the datadog_monitor_json in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_monitor_json to import is found + * @param importToId The construct id used in the generated config for the MonitorJson to import + * @param importFromId The id of the existing MonitorJson that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/monitor_json#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the MonitorJson to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitor_json", importId: importFromId, provider }); @@ -191125,11 +191125,11 @@ export class Monitor extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Monitor resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_monitor to import to, as it appears in generated config - * @param importFormId The id of the datadog_monitor in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_monitor to import is found + * @param importToId The construct id used in the generated config for the Monitor to import + * @param importFromId The id of the existing Monitor that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/monitor#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Monitor to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_monitor", importId: importFromId, provider }); @@ -192235,11 +192235,11 @@ export class OrganizationSettings extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a OrganizationSettings resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_organization_settings to import to, as it appears in generated config - * @param importFormId The id of the datadog_organization_settings in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_organization_settings to import is found + * @param importToId The construct id used in the generated config for the OrganizationSettings to import + * @param importFromId The id of the existing OrganizationSettings that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/organization_settings#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the OrganizationSettings to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_organization_settings", importId: importFromId, provider }); @@ -192423,11 +192423,11 @@ export class DatadogProvider extends cdktf.TerraformProvider { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DatadogProvider resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog to import to, as it appears in generated config - * @param importFormId The id of the datadog in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog to import is found + * @param importToId The construct id used in the generated config for the DatadogProvider to import + * @param importFromId The id of the existing DatadogProvider that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DatadogProvider to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog", importId: importFromId, provider }); @@ -192748,11 +192748,11 @@ export class Role extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Role resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_role to import to, as it appears in generated config - * @param importFormId The id of the datadog_role in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_role to import is found + * @param importToId The construct id used in the generated config for the Role to import + * @param importFromId The id of the existing Role that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/role#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Role to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_role", importId: importFromId, provider }); @@ -193155,11 +193155,11 @@ export class SecurityMonitoringDefaultRule extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SecurityMonitoringDefaultRule resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_security_monitoring_default_rule to import to, as it appears in generated config - * @param importFormId The id of the datadog_security_monitoring_default_rule in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_security_monitoring_default_rule to import is found + * @param importToId The construct id used in the generated config for the SecurityMonitoringDefaultRule to import + * @param importFromId The id of the existing SecurityMonitoringDefaultRule that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/security_monitoring_default_rule#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SecurityMonitoringDefaultRule to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_default_rule", importId: importFromId, provider }); @@ -193468,11 +193468,11 @@ export class SecurityMonitoringFilter extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SecurityMonitoringFilter resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_security_monitoring_filter to import to, as it appears in generated config - * @param importFormId The id of the datadog_security_monitoring_filter in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_security_monitoring_filter to import is found + * @param importToId The construct id used in the generated config for the SecurityMonitoringFilter to import + * @param importFromId The id of the existing SecurityMonitoringFilter that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/security_monitoring_filter#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SecurityMonitoringFilter to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_filter", importId: importFromId, provider }); @@ -194781,11 +194781,11 @@ export class SecurityMonitoringRule extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SecurityMonitoringRule resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_security_monitoring_rule to import to, as it appears in generated config - * @param importFormId The id of the datadog_security_monitoring_rule in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_security_monitoring_rule to import is found + * @param importToId The construct id used in the generated config for the SecurityMonitoringRule to import + * @param importFromId The id of the existing SecurityMonitoringRule that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/security_monitoring_rule#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SecurityMonitoringRule to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_security_monitoring_rule", importId: importFromId, provider }); @@ -195367,11 +195367,11 @@ export class ServiceLevelObjective extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ServiceLevelObjective resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_service_level_objective to import to, as it appears in generated config - * @param importFormId The id of the datadog_service_level_objective in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_service_level_objective to import is found + * @param importToId The construct id used in the generated config for the ServiceLevelObjective to import + * @param importFromId The id of the existing ServiceLevelObjective that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/service_level_objective#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ServiceLevelObjective to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_service_level_objective", importId: importFromId, provider }); @@ -195693,11 +195693,11 @@ export class SloCorrection extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SloCorrection resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_slo_correction to import to, as it appears in generated config - * @param importFormId The id of the datadog_slo_correction in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_slo_correction to import is found + * @param importToId The construct id used in the generated config for the SloCorrection to import + * @param importFromId The id of the existing SloCorrection that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/slo_correction#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SloCorrection to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_slo_correction", importId: importFromId, provider }); @@ -196195,11 +196195,11 @@ export class SyntheticsGlobalVariable extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SyntheticsGlobalVariable resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_synthetics_global_variable to import to, as it appears in generated config - * @param importFormId The id of the datadog_synthetics_global_variable in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_synthetics_global_variable to import is found + * @param importToId The construct id used in the generated config for the SyntheticsGlobalVariable to import + * @param importFromId The id of the existing SyntheticsGlobalVariable that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/synthetics_global_variable#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SyntheticsGlobalVariable to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_global_variable", importId: importFromId, provider }); @@ -196531,11 +196531,11 @@ export class SyntheticsPrivateLocation extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SyntheticsPrivateLocation resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_synthetics_private_location to import to, as it appears in generated config - * @param importFormId The id of the datadog_synthetics_private_location in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_synthetics_private_location to import is found + * @param importToId The construct id used in the generated config for the SyntheticsPrivateLocation to import + * @param importFromId The id of the existing SyntheticsPrivateLocation that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/synthetics_private_location#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SyntheticsPrivateLocation to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_private_location", importId: importFromId, provider }); @@ -202704,11 +202704,11 @@ export class SyntheticsTest extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SyntheticsTest resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_synthetics_test to import to, as it appears in generated config - * @param importFormId The id of the datadog_synthetics_test in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_synthetics_test to import is found + * @param importToId The construct id used in the generated config for the SyntheticsTest to import + * @param importFromId The id of the existing SyntheticsTest that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/synthetics_test#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SyntheticsTest to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_synthetics_test", importId: importFromId, provider }); @@ -203212,11 +203212,11 @@ export class User extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a User resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_user to import to, as it appears in generated config - * @param importFormId The id of the datadog_user in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_user to import is found + * @param importToId The construct id used in the generated config for the User to import + * @param importFromId The id of the existing User that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/user#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the User to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_user", importId: importFromId, provider }); @@ -203434,11 +203434,11 @@ export class WebhookCustomVariable extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a WebhookCustomVariable resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_webhook_custom_variable to import to, as it appears in generated config - * @param importFormId The id of the datadog_webhook_custom_variable in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_webhook_custom_variable to import is found + * @param importToId The construct id used in the generated config for the WebhookCustomVariable to import + * @param importFromId The id of the existing WebhookCustomVariable that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/webhook_custom_variable#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the WebhookCustomVariable to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_webhook_custom_variable", importId: importFromId, provider }); @@ -203616,11 +203616,11 @@ export class Webhook extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Webhook resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_webhook to import to, as it appears in generated config - * @param importFormId The id of the datadog_webhook in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_webhook to import is found + * @param importToId The construct id used in the generated config for the Webhook to import + * @param importFromId The id of the existing Webhook that should be imported. Refer to the {@link https://registry.terraform.io/providers/datadog/datadog/3.12.0/docs/resources/webhook#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Webhook to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_webhook", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap index e59b04edd5..7d05d49a44 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap @@ -215,11 +215,11 @@ export class AcmCertificate extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a AcmCertificate resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_acm_certificate to import to, as it appears in generated config - * @param importFormId The id of the aws_acm_certificate in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_acm_certificate to import is found + * @param importToId The construct id used in the generated config for the AcmCertificate to import + * @param importFromId The id of the existing AcmCertificate that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/acm_certificate#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the AcmCertificate to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_acm_certificate", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap index 283c9e723f..3f7e29228a 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/description-escaping.test.ts.snap @@ -38,11 +38,11 @@ export class DescriptionEscaping extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DescriptionEscaping resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the description_escaping to import to, as it appears in generated config - * @param importFormId The id of the description_escaping in the cloud provider to generate config of - * @param provider? Instance of the provider where description_escaping to import is found + * @param importToId The construct id used in the generated config for the DescriptionEscaping to import + * @param importFromId The id of the existing DescriptionEscaping that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/description_escaping#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DescriptionEscaping to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "description_escaping", importId: importFromId, provider }); @@ -140,11 +140,11 @@ export class CodeBlocks extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a CodeBlocks resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the code_blocks to import to, as it appears in generated config - * @param importFormId The id of the code_blocks in the cloud provider to generate config of - * @param provider? Instance of the provider where code_blocks to import is found + * @param importToId The construct id used in the generated config for the CodeBlocks to import + * @param importFromId The id of the existing CodeBlocks that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/code_blocks#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the CodeBlocks to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "code_blocks", importId: importFromId, provider }); @@ -240,11 +240,11 @@ export class CodeBlocks extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a CodeBlocks resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the code_blocks to import to, as it appears in generated config - * @param importFormId The id of the code_blocks in the cloud provider to generate config of - * @param provider? Instance of the provider where code_blocks to import is found + * @param importToId The construct id used in the generated config for the CodeBlocks to import + * @param importFromId The id of the existing CodeBlocks that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/code_blocks#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the CodeBlocks to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "code_blocks", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap index 2e82bed3a1..19f13dc617 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap @@ -111,11 +111,11 @@ export class Dashboard extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Dashboard resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the datadog_dashboard to import to, as it appears in generated config - * @param importFormId The id of the datadog_dashboard in the cloud provider to generate config of - * @param provider? Instance of the provider where datadog_dashboard to import is found + * @param importToId The construct id used in the generated config for the Dashboard to import + * @param importFromId The id of the existing Dashboard that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/datadog/latest/docs/resources/dashboard#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Dashboard to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "datadog_dashboard", importId: importFromId, provider }); @@ -146879,11 +146879,11 @@ export class Wafv2WebAcl extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Wafv2WebAcl resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_wafv2_web_acl to import to, as it appears in generated config - * @param importFormId The id of the aws_wafv2_web_acl in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_wafv2_web_acl to import is found + * @param importToId The construct id used in the generated config for the Wafv2WebAcl to import + * @param importFromId The id of the existing Wafv2WebAcl that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Wafv2WebAcl to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_wafv2_web_acl", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap index bbfe0cfd13..bb9ee16711 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap @@ -304,11 +304,11 @@ export class NestedTypesResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a NestedTypesResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the nested_types_resource to import to, as it appears in generated config - * @param importFormId The id of the nested_types_resource in the cloud provider to generate config of - * @param provider? Instance of the provider where nested_types_resource to import is found + * @param importToId The construct id used in the generated config for the NestedTypesResource to import + * @param importFromId The id of the existing NestedTypesResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/nested_types_resource#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the NestedTypesResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "nested_types_resource", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap index 242f8d6b01..ad52b71cb2 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/provider.test.ts.snap @@ -1174,11 +1174,11 @@ export class AwsProvider extends cdktf.TerraformProvider { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a AwsProvider resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws to import to, as it appears in generated config - * @param importFormId The id of the aws in the cloud provider to generate config of - * @param provider? Instance of the provider where aws to import is found + * @param importToId The construct id used in the generated config for the AwsProvider to import + * @param importFromId The id of the existing AwsProvider that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the AwsProvider to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws", importId: importFromId, provider }); @@ -1705,11 +1705,11 @@ export class ElasticstackProvider extends cdktf.TerraformProvider { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ElasticstackProvider resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the elasticstack to import to, as it appears in generated config - * @param importFormId The id of the elasticstack in the cloud provider to generate config of - * @param provider? Instance of the provider where elasticstack to import is found + * @param importToId The construct id used in the generated config for the ElasticstackProvider to import + * @param importFromId The id of the existing ElasticstackProvider that should be imported. Refer to the {@link https://registry.terraform.io/providers/elastic/elasticstack/latest/docs#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ElasticstackProvider to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "elasticstack", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap index 3de33b1606..73296c0090 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap @@ -4024,11 +4024,11 @@ export class CloudfrontDistribution extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a CloudfrontDistribution resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_cloudfront_distribution to import to, as it appears in generated config - * @param importFormId The id of the aws_cloudfront_distribution in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_cloudfront_distribution to import is found + * @param importToId The construct id used in the generated config for the CloudfrontDistribution to import + * @param importFromId The id of the existing CloudfrontDistribution that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the CloudfrontDistribution to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_cloudfront_distribution", importId: importFromId, provider }); @@ -4523,11 +4523,11 @@ export class FmsAdminAccount extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a FmsAdminAccount resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_fms_admin_account to import to, as it appears in generated config - * @param importFormId The id of the aws_fms_admin_account in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_fms_admin_account to import is found + * @param importToId The construct id used in the generated config for the FmsAdminAccount to import + * @param importFromId The id of the existing FmsAdminAccount that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/fms_admin_account#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the FmsAdminAccount to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_fms_admin_account", importId: importFromId, provider }); @@ -7551,11 +7551,11 @@ export class S3Bucket extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a S3Bucket resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_s3_bucket to import to, as it appears in generated config - * @param importFormId The id of the aws_s3_bucket in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_s3_bucket to import is found + * @param importToId The construct id used in the generated config for the S3Bucket to import + * @param importFromId The id of the existing S3Bucket that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the S3Bucket to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_s3_bucket", importId: importFromId, provider }); @@ -8827,11 +8827,11 @@ export class SecurityGroup extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SecurityGroup resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_security_group to import to, as it appears in generated config - * @param importFormId The id of the aws_security_group in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_security_group to import is found + * @param importToId The construct id used in the generated config for the SecurityGroup to import + * @param importFromId The id of the existing SecurityGroup that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SecurityGroup to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_security_group", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap index d6b6196753..a7ec1b65fc 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap @@ -692,11 +692,11 @@ export class QuicksightTemplate extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a QuicksightTemplate resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_quicksight_template to import to, as it appears in generated config - * @param importFormId The id of the aws_quicksight_template in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_quicksight_template to import is found + * @param importToId The construct id used in the generated config for the QuicksightTemplate to import + * @param importFromId The id of the existing QuicksightTemplate that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_template#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the QuicksightTemplate to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_quicksight_template", importId: importFromId, provider }); diff --git a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap index f091d6cdd9..51aa77d77f 100644 --- a/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap +++ b/packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/types.test.ts.snap @@ -34,11 +34,11 @@ export class BooleanList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a BooleanList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_boolean_list to import to, as it appears in generated config - * @param importFormId The id of the aws_boolean_list in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_boolean_list to import is found + * @param importToId The construct id used in the generated config for the BooleanList to import + * @param importFromId The id of the existing BooleanList that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/boolean_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the BooleanList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_boolean_list", importId: importFromId, provider }); @@ -160,11 +160,11 @@ export class BooleanMap extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a BooleanMap resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_boolean_map to import to, as it appears in generated config - * @param importFormId The id of the aws_boolean_map in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_boolean_map to import is found + * @param importToId The construct id used in the generated config for the BooleanMap to import + * @param importFromId The id of the existing BooleanMap that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/boolean_map#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the BooleanMap to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_boolean_map", importId: importFromId, provider }); @@ -385,11 +385,11 @@ export class ComputedComplex extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ComputedComplex resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_computed_complex to import to, as it appears in generated config - * @param importFormId The id of the aws_computed_complex in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_computed_complex to import is found + * @param importToId The construct id used in the generated config for the ComputedComplex to import + * @param importFromId The id of the existing ComputedComplex that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/computed_complex#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ComputedComplex to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_computed_complex", importId: importFromId, provider }); @@ -604,11 +604,11 @@ export class ComputedComplexNested extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ComputedComplexNested resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_computed_complex_nested to import to, as it appears in generated config - * @param importFormId The id of the aws_computed_complex_nested in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_computed_complex_nested to import is found + * @param importToId The construct id used in the generated config for the ComputedComplexNested to import + * @param importFromId The id of the existing ComputedComplexNested that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/computed_complex_nested#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ComputedComplexNested to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_computed_complex_nested", importId: importFromId, provider }); @@ -869,11 +869,11 @@ export class BlockTypeNestedComputedList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a BlockTypeNestedComputedList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_block_type_nested_computed_list to import to, as it appears in generated config - * @param importFormId The id of the aws_block_type_nested_computed_list in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_block_type_nested_computed_list to import is found + * @param importToId The construct id used in the generated config for the BlockTypeNestedComputedList to import + * @param importFromId The id of the existing BlockTypeNestedComputedList that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/block_type_nested_computed_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the BlockTypeNestedComputedList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_block_type_nested_computed_list", importId: importFromId, provider }); @@ -1283,11 +1283,11 @@ export class ComputedOptionalComplex extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ComputedOptionalComplex resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_computed_optional_complex to import to, as it appears in generated config - * @param importFormId The id of the aws_computed_optional_complex in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_computed_optional_complex to import is found + * @param importToId The construct id used in the generated config for the ComputedOptionalComplex to import + * @param importFromId The id of the existing ComputedOptionalComplex that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/computed_optional_complex#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ComputedOptionalComplex to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_computed_optional_complex", importId: importFromId, provider }); @@ -1577,11 +1577,11 @@ export class DeeplyNestedBlockTypes extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DeeplyNestedBlockTypes resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_deeply_nested_block_types to import to, as it appears in generated config - * @param importFormId The id of the aws_deeply_nested_block_types in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_deeply_nested_block_types to import is found + * @param importToId The construct id used in the generated config for the DeeplyNestedBlockTypes to import + * @param importFromId The id of the existing DeeplyNestedBlockTypes that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/deeply_nested_block_types#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DeeplyNestedBlockTypes to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_deeply_nested_block_types", importId: importFromId, provider }); @@ -1681,11 +1681,11 @@ export class IgnoredAttributes extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IgnoredAttributes resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_ignored_attributes to import to, as it appears in generated config - * @param importFormId The id of the aws_ignored_attributes in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_ignored_attributes to import is found + * @param importToId The construct id used in the generated config for the IgnoredAttributes to import + * @param importFromId The id of the existing IgnoredAttributes that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ignored_attributes#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IgnoredAttributes to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_ignored_attributes", importId: importFromId, provider }); @@ -1803,11 +1803,11 @@ export class IncompatibleAttributeNames extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a IncompatibleAttributeNames resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_incompatible_attribute_names to import to, as it appears in generated config - * @param importFormId The id of the aws_incompatible_attribute_names in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_incompatible_attribute_names to import is found + * @param importToId The construct id used in the generated config for the IncompatibleAttributeNames to import + * @param importFromId The id of the existing IncompatibleAttributeNames that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/incompatible_attribute_names#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the IncompatibleAttributeNames to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_incompatible_attribute_names", importId: importFromId, provider }); @@ -1964,11 +1964,11 @@ export class FunctionResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a FunctionResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_function to import to, as it appears in generated config - * @param importFormId The id of the test_function in the cloud provider to generate config of - * @param provider? Instance of the provider where test_function to import is found + * @param importToId The construct id used in the generated config for the FunctionResource to import + * @param importFromId The id of the existing FunctionResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/function#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the FunctionResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_function", importId: importFromId, provider }); @@ -2089,11 +2089,11 @@ export class LicenseResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a LicenseResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_license to import to, as it appears in generated config - * @param importFormId The id of the test_license in the cloud provider to generate config of - * @param provider? Instance of the provider where test_license to import is found + * @param importToId The construct id used in the generated config for the LicenseResource to import + * @param importFromId The id of the existing LicenseResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/license#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the LicenseResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_license", importId: importFromId, provider }); @@ -2190,11 +2190,11 @@ export class ObjectResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ObjectResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_object to import to, as it appears in generated config - * @param importFormId The id of the test_object in the cloud provider to generate config of - * @param provider? Instance of the provider where test_object to import is found + * @param importToId The construct id used in the generated config for the ObjectResource to import + * @param importFromId The id of the existing ObjectResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/object#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ObjectResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_object", importId: importFromId, provider }); @@ -2291,11 +2291,11 @@ export class ProviderResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ProviderResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_provider to import to, as it appears in generated config - * @param importFormId The id of the test_provider in the cloud provider to generate config of - * @param provider? Instance of the provider where test_provider to import is found + * @param importToId The construct id used in the generated config for the ProviderResource to import + * @param importFromId The id of the existing ProviderResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/provider#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ProviderResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_provider", importId: importFromId, provider }); @@ -2392,11 +2392,11 @@ export class StaticResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a StaticResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_static to import to, as it appears in generated config - * @param importFormId The id of the test_static in the cloud provider to generate config of - * @param provider? Instance of the provider where test_static to import is found + * @param importToId The construct id used in the generated config for the StaticResource to import + * @param importFromId The id of the existing StaticResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/static#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the StaticResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_static", importId: importFromId, provider }); @@ -2493,11 +2493,11 @@ export class StringResource extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a StringResource resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_string to import to, as it appears in generated config - * @param importFormId The id of the test_string in the cloud provider to generate config of - * @param provider? Instance of the provider where test_string to import is found + * @param importToId The construct id used in the generated config for the StringResource to import + * @param importFromId The id of the existing StringResource that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/string#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the StringResource to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_string", importId: importFromId, provider }); @@ -2942,11 +2942,11 @@ export class Complex extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a Complex resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the test_complex to import to, as it appears in generated config - * @param importFormId The id of the test_complex in the cloud provider to generate config of - * @param provider? Instance of the provider where test_complex to import is found + * @param importToId The construct id used in the generated config for the Complex to import + * @param importFromId The id of the existing Complex that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/resources/complex#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the Complex to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "test_complex", importId: importFromId, provider }); @@ -3160,11 +3160,11 @@ export class DataAirbyteSourceSchemaCatalog extends cdktf.TerraformDataSource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a DataAirbyteSourceSchemaCatalog resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the airbyte_source_schema_catalog to import to, as it appears in generated config - * @param importFormId The id of the airbyte_source_schema_catalog in the cloud provider to generate config of - * @param provider? Instance of the provider where airbyte_source_schema_catalog to import is found + * @param importToId The construct id used in the generated config for the DataAirbyteSourceSchemaCatalog to import + * @param importFromId The id of the existing DataAirbyteSourceSchemaCatalog that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/test/latest/docs/data-sources/airbyte_source_schema_catalog#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the DataAirbyteSourceSchemaCatalog to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "airbyte_source_schema_catalog", importId: importFromId, provider }); @@ -3269,11 +3269,11 @@ export class ListOfStringMap extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a ListOfStringMap resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_list_of_string_map to import to, as it appears in generated config - * @param importFormId The id of the aws_list_of_string_map in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_list_of_string_map to import is found + * @param importToId The construct id used in the generated config for the ListOfStringMap to import + * @param importFromId The id of the existing ListOfStringMap that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/list_of_string_map#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the ListOfStringMap to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_list_of_string_map", importId: importFromId, provider }); @@ -3378,11 +3378,11 @@ export class MapOfStringList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a MapOfStringList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_map_of_string_list to import to, as it appears in generated config - * @param importFormId The id of the aws_map_of_string_list in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_map_of_string_list to import is found + * @param importToId The construct id used in the generated config for the MapOfStringList to import + * @param importFromId The id of the existing MapOfStringList that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/map_of_string_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the MapOfStringList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_map_of_string_list", importId: importFromId, provider }); @@ -3489,11 +3489,11 @@ export class NumberList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a NumberList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_number_list to import to, as it appears in generated config - * @param importFormId The id of the aws_number_list in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_number_list to import is found + * @param importToId The construct id used in the generated config for the NumberList to import + * @param importFromId The id of the existing NumberList that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/number_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the NumberList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_number_list", importId: importFromId, provider }); @@ -3609,11 +3609,11 @@ export class NumberMap extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a NumberMap resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_number_map to import to, as it appears in generated config - * @param importFormId The id of the aws_number_map in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_number_map to import is found + * @param importToId The construct id used in the generated config for the NumberMap to import + * @param importFromId The id of the existing NumberMap that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/number_map#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the NumberMap to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_number_map", importId: importFromId, provider }); @@ -3742,11 +3742,11 @@ export class PrimitiveBoolean extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a PrimitiveBoolean resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_primitive_boolean to import to, as it appears in generated config - * @param importFormId The id of the aws_primitive_boolean in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_primitive_boolean to import is found + * @param importToId The construct id used in the generated config for the PrimitiveBoolean to import + * @param importFromId The id of the existing PrimitiveBoolean that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/primitive_boolean#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the PrimitiveBoolean to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_boolean", importId: importFromId, provider }); @@ -3889,11 +3889,11 @@ export class PrimitiveDynamic extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a PrimitiveDynamic resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_primitive_dynamic to import to, as it appears in generated config - * @param importFormId The id of the aws_primitive_dynamic in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_primitive_dynamic to import is found + * @param importToId The construct id used in the generated config for the PrimitiveDynamic to import + * @param importFromId The id of the existing PrimitiveDynamic that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/primitive_dynamic#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the PrimitiveDynamic to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_dynamic", importId: importFromId, provider }); @@ -4037,11 +4037,11 @@ export class PrimitiveNumber extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a PrimitiveNumber resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_primitive_number to import to, as it appears in generated config - * @param importFormId The id of the aws_primitive_number in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_primitive_number to import is found + * @param importToId The construct id used in the generated config for the PrimitiveNumber to import + * @param importFromId The id of the existing PrimitiveNumber that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/primitive_number#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the PrimitiveNumber to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_number", importId: importFromId, provider }); @@ -4184,11 +4184,11 @@ export class PrimitiveString extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a PrimitiveString resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_primitive_string to import to, as it appears in generated config - * @param importFormId The id of the aws_primitive_string in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_primitive_string to import is found + * @param importToId The construct id used in the generated config for the PrimitiveString to import + * @param importFromId The id of the existing PrimitiveString that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/primitive_string#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the PrimitiveString to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_primitive_string", importId: importFromId, provider }); @@ -4335,11 +4335,11 @@ export class NameConflict extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a NameConflict resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_name_conflict to import to, as it appears in generated config - * @param importFormId The id of the aws_name_conflict in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_name_conflict to import is found + * @param importToId The construct id used in the generated config for the NameConflict to import + * @param importFromId The id of the existing NameConflict that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/name_conflict#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the NameConflict to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_name_conflict", importId: importFromId, provider }); @@ -4692,11 +4692,11 @@ export class BlockTypeSetList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a BlockTypeSetList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_block_type_set_list to import to, as it appears in generated config - * @param importFormId The id of the aws_block_type_set_list in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_block_type_set_list to import is found + * @param importToId The construct id used in the generated config for the BlockTypeSetList to import + * @param importFromId The id of the existing BlockTypeSetList that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/block_type_set_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the BlockTypeSetList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_block_type_set_list", importId: importFromId, provider }); @@ -4888,11 +4888,11 @@ export class SingleBlockType extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a SingleBlockType resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_single_block_type to import to, as it appears in generated config - * @param importFormId The id of the aws_single_block_type in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_single_block_type to import is found + * @param importToId The construct id used in the generated config for the SingleBlockType to import + * @param importFromId The id of the existing SingleBlockType that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/single_block_type#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the SingleBlockType to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_single_block_type", importId: importFromId, provider }); @@ -4997,11 +4997,11 @@ export class StringList extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a StringList resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_string_list to import to, as it appears in generated config - * @param importFormId The id of the aws_string_list in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_string_list to import is found + * @param importToId The construct id used in the generated config for the StringList to import + * @param importFromId The id of the existing StringList that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/string_list#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the StringList to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_string_list", importId: importFromId, provider }); @@ -5144,11 +5144,11 @@ export class StringMap extends cdktf.TerraformResource { // STATIC Methods // ============== /** - * For generation of configuration for import, run "cdktf plan " + * Generates CDKTF code for importing a StringMap resource upon running "cdktf plan " * @param scope The scope in which to define this construct - * @param importToId The id of the aws_string_map to import to, as it appears in generated config - * @param importFormId The id of the aws_string_map in the cloud provider to generate config of - * @param provider? Instance of the provider where aws_string_map to import is found + * @param importToId The construct id used in the generated config for the StringMap to import + * @param importFromId The id of the existing StringMap that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/string_map#import import section} in the documentation of this resource for the id to use + * @param provider? Optional instance of the provider where the StringMap to import is found */ public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_string_map", importId: importFromId, provider }); From e8834795e4bccefea6a93599b296555dbb5bce4a Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Wed, 27 Sep 2023 09:54:11 -0400 Subject: [PATCH 58/58] fix: typo in docs --- website/docs/cdktf/concepts/resources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/cdktf/concepts/resources.mdx b/website/docs/cdktf/concepts/resources.mdx index 683ecf32c9..49ade20959 100644 --- a/website/docs/cdktf/concepts/resources.mdx +++ b/website/docs/cdktf/concepts/resources.mdx @@ -387,7 +387,7 @@ If you have existing resources that you want to manage with CDKTF, you can impor ### How To Import -To import a resource, first instantiate an instance of the resource type you wish to import– in our case we'll be using an S3Bucket. No configuration is explicitly needed. You then call the `importFrom` method on the resource object. This method takes the ID of the resource to be imported as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. +To import a resource, first instantiate an instance of the resource type you wish to import – in our case we'll be using an S3Bucket. No configuration is explicitly needed. You then call the `importFrom` method on the resource object. This method takes the ID of the resource to be imported as the first argument and the provider as an optional second. The provider is only required if you have multiple providers of the same type in your configuration. ```typescript new S3Bucket(this, "bucket", {}).importFrom(bucketId);