archive_file (Data Source)

Generates an archive from content, a file, or directory of files.

Example Usage

// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { TerraformStack } from "cdktf";
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import { DataArchiveFile } from "./.gen/providers/archive/data-archive-file";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    new DataArchiveFile(this, "init", {
      outputPath: "${path.module}/files/init.zip",
      sourceFile: "${path.module}/init.tpl",
      type: "zip",
    });
  }
}
// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { Token, TerraformStack } from "cdktf";
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import { DataArchiveFile } from "./.gen/providers/archive/data-archive-file";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    new DataArchiveFile(this, "dotfiles", {
      excludes: ["${path.module}/unwanted.zip"],
      outputPath: "${path.module}/files/dotfiles.zip",
      source: [
        {
          content: Token.asString(vimrc.rendered),
          filename: ".vimrc",
        },
        {
          content: Token.asString(sshConfig.rendered),
          filename: ".ssh/config",
        },
      ],
      type: "zip",
    });
  }
}
// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { TerraformStack } from "cdktf";
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import { DataArchiveFile } from "./.gen/providers/archive/data-archive-file";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    new DataArchiveFile(this, "lambda_my_function", {
      outputFileMode: "0666",
      outputPath: "${path.module}/files/lambda-my-function.js.zip",
      sourceFile: "${path.module}/../lambda/my-function/index.js",
      type: "zip",
    });
  }
}

Schema

Required

Optional

Read-Only

Nested Schema for source

Required: