@datadog/datadog-ci-plugin-terraform 5.27.0 → 5.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,6 +16,7 @@ datadog-ci terraform upload [plan|state] <path/to/terraform-file.json> [addition
16
16
  ### Optional arguments
17
17
 
18
18
  - `--repo-id` (optional): Repository identifier override (e.g., github.com/datadog/my-repo)
19
+ - `--expected-plans` (optional): Total number of plans the pipeline uploads for this commit, across all jobs combined. Only valid for `plan` uploads. Defaults to the number of plan files passed to the command, which is correct when a single command uploads every plan of the commit. If the plans are uploaded by several commands (for example, one per job), pass the same total to every command. If the value is lower than the number of plan files passed to the command, the number of files is used instead (with a warning).
19
20
  - `--dry-run` (default: `false`): Run the command without uploading any data to Datadog
20
21
  - `--verbose` (default: `false`): Enable verbose logging
21
22
  - `--skip-git-metadata-upload` (default: `false`): Skip the upload of git metadata
@@ -50,6 +51,12 @@ datadog-ci terraform upload state ./terraform.tfstate
50
51
  # Upload with manual repo-id override
51
52
  datadog-ci terraform upload plan ./terraform-plan.json --repo-id "github.com/my-org/my-repo"
52
53
 
54
+ # Declare that the pipeline uploads 3 plans in total for this commit (for example, one per job) using the flag
55
+ datadog-ci terraform upload plan ./terraform-plan.json --expected-plans 3
56
+
57
+ # In a shared CI template (sh/bash), forward an optional pipeline variable as the flag
58
+ datadog-ci terraform upload plan ./terraform-plan.json ${EXPECTED_PLANS:+--expected-plans "$EXPECTED_PLANS"}
59
+
53
60
  # Dry run mode
54
61
  datadog-ci terraform upload plan ./terraform-plan.json --dry-run
55
62
 
package/dist/bundle.d.ts CHANGED
@@ -297,6 +297,19 @@ declare abstract class Command<Context extends BaseContext = BaseContext> {
297
297
  static Default: never[];
298
298
  }
299
299
  //#endregion
300
+ //#region ../base/dist/helpers/auth.d.ts
301
+ /**
302
+ * The authentication requirement of a command, declared with `public static authRequirement` on its base command class
303
+ * in `packages/base/src/commands/**`, next to the options it describes. A test checks that every registered command
304
+ * declares one.
305
+ */
306
+ type AuthRequirement = {
307
+ kind: 'orgAction' | 'apiKey' | 'none';
308
+ } /** A command-specific text, for example the cloud credentials and Datadog variables a Serverless command reads. */ | {
309
+ kind: 'custom';
310
+ help: string;
311
+ };
312
+ //#endregion
300
313
  //#region ../base/dist/helpers/logger.d.ts
301
314
  declare enum LogLevel {
302
315
  DEBUG = 1,
@@ -339,7 +352,12 @@ type CommandContext = BaseContext & {
339
352
  * This command should be extended by **every** command in the monorepo.
340
353
  */
341
354
  declare abstract class BaseCommand<Context extends CommandContext = CommandContext> extends Command<Context> {
342
- protected logFormat: "json" | "text";
355
+ /**
356
+ * The credentials the command needs, shown in the "Authentication" section of its `--help`.
357
+ * Every command declares one; plugin commands inherit it from their base command.
358
+ */
359
+ static authRequirement?: AuthRequirement;
360
+ protected logFormat: "text" | "json";
343
361
  private _logger?;
344
362
  get logger(): Logger;
345
363
  }
@@ -348,9 +366,11 @@ declare abstract class BaseCommand<Context extends CommandContext = CommandConte
348
366
  declare class TerraformUploadCommand extends BaseCommand {
349
367
  static paths: string[][];
350
368
  static usage: Usage;
369
+ static authRequirement: AuthRequirement;
351
370
  protected artifactType: "plan" | "state";
352
371
  protected filePaths: string[];
353
372
  protected repoId: string | undefined;
373
+ protected expectedPlans: number | undefined;
354
374
  protected skipGitMetadataUpload: boolean;
355
375
  protected verbose: boolean;
356
376
  protected fips: boolean;
@@ -363,6 +383,7 @@ declare class TerraformUploadCommand extends BaseCommand {
363
383
  declare class PluginCommand extends TerraformUploadCommand {
364
384
  private config;
365
385
  private git;
386
+ private expectedPlanCount;
366
387
  execute(): Promise<1 | 0>;
367
388
  private syncGitMetadata;
368
389
  private uploadToGitDB;