diff --git a/docs/cdktf/python/data-sources/file.md b/docs/cdktf/python/data-sources/file.md index 9188a7c8..8d2a4f08 100644 --- a/docs/cdktf/python/data-sources/file.md +++ b/docs/cdktf/python/data-sources/file.md @@ -2,14 +2,14 @@ page_title: "archive_file Data Source - terraform-provider-archive" subcategory: "" description: |- - Generates an archive from content, a file, or directory of files. + Generates an archive from content, a file, or directory of files. The archive is built during the terraform plan, so you must persist the archive through to the terraform apply. See the archive_file resource for an alternative if you cannot persist the file, such as in a multi-phase CI or build server context. --- # archive_file (Data Source) -Generates an archive from content, a file, or directory of files. +Generates an archive from content, a file, or directory of files. The archive is built during the terraform plan, so you must persist the archive through to the terraform apply. See the `archive_file` resource for an alternative if you cannot persist the file, such as in a multi-phase CI or build server context. ## Example Usage @@ -117,4 +117,4 @@ Required: - `content` (String) Add this content to the archive with `filename` as the filename. - `filename` (String) Set this as the filename when declaring a `source`. - \ No newline at end of file + \ No newline at end of file diff --git a/docs/cdktf/python/resources/file.md b/docs/cdktf/python/resources/file.md index 4d12602c..943c8b63 100644 --- a/docs/cdktf/python/resources/file.md +++ b/docs/cdktf/python/resources/file.md @@ -1,18 +1,83 @@ --- - - -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "archive_file Resource - terraform-provider-archive" subcategory: "" description: |- - NOTE: This resource is deprecated, use data source instead. + Generates an archive from content, a file, or directory of files. --- -# archive_file (Resource) - -**NOTE**: This resource is deprecated, use data source instead. + +# archive_file (Resource) +Generates an archive from content, a file, or directory of files. + +## Example Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.archive.file import File +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + File(self, "init", + output_path="${path.module}/files/init.zip", + source_file="${path.module}/init.tpl", + type="zip" + ) +``` + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import Token, TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.archive.file import File +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + File(self, "dotfiles", + excludes=["${path.module}/unwanted.zip"], + output_path="${path.module}/files/dotfiles.zip", + source=[FileSource( + content=Token.as_string(vimrc.rendered), + filename=".vimrc" + ), FileSource( + content=Token.as_string(ssh_config.rendered), + filename=".ssh/config" + ) + ], + type="zip" + ) +``` + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.archive.file import File +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + File(self, "lambda_my_function", + output_file_mode="0666", + output_path="${path.module}/files/lambda-my-function.js.zip", + source_file="${path.module}/../lambda/my-function/index.js", + type="zip" + ) +``` ## Schema @@ -52,4 +117,4 @@ Required: - `content` (String) Add this content to the archive with `filename` as the filename. - `filename` (String) Set this as the filename when declaring a `source`. - \ No newline at end of file + \ No newline at end of file diff --git a/docs/cdktf/typescript/data-sources/file.md b/docs/cdktf/typescript/data-sources/file.md index 8416a55e..35285457 100644 --- a/docs/cdktf/typescript/data-sources/file.md +++ b/docs/cdktf/typescript/data-sources/file.md @@ -2,14 +2,14 @@ page_title: "archive_file Data Source - terraform-provider-archive" subcategory: "" description: |- - Generates an archive from content, a file, or directory of files. + Generates an archive from content, a file, or directory of files. The archive is built during the terraform plan, so you must persist the archive through to the terraform apply. See the archive_file resource for an alternative if you cannot persist the file, such as in a multi-phase CI or build server context. --- # archive_file (Data Source) -Generates an archive from content, a file, or directory of files. +Generates an archive from content, a file, or directory of files. The archive is built during the terraform plan, so you must persist the archive through to the terraform apply. See the `archive_file` resource for an alternative if you cannot persist the file, such as in a multi-phase CI or build server context. ## Example Usage @@ -128,4 +128,4 @@ Required: - `content` (String) Add this content to the archive with `filename` as the filename. - `filename` (String) Set this as the filename when declaring a `source`. - \ No newline at end of file + \ No newline at end of file diff --git a/docs/cdktf/typescript/resources/file.md b/docs/cdktf/typescript/resources/file.md index 28001721..5e2c2d64 100644 --- a/docs/cdktf/typescript/resources/file.md +++ b/docs/cdktf/typescript/resources/file.md @@ -1,18 +1,94 @@ --- - - -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "archive_file Resource - terraform-provider-archive" subcategory: "" description: |- - NOTE: This resource is deprecated, use data source instead. + Generates an archive from content, a file, or directory of files. --- -# archive_file (Resource) - -**NOTE**: This resource is deprecated, use data source instead. + +# archive_file (Resource) +Generates an archive from content, a file, or directory of files. + +## Example Usage + +```typescript +// 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 { File } from "./.gen/providers/archive/file"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + new File(this, "init", { + outputPath: "${path.module}/files/init.zip", + sourceFile: "${path.module}/init.tpl", + type: "zip", + }); + } +} + +``` + +```typescript +// 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 { File } from "./.gen/providers/archive/file"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + new File(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", + }); + } +} + +``` + +```typescript +// 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 { File } from "./.gen/providers/archive/file"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + new File(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 @@ -52,4 +128,4 @@ Required: - `content` (String) Add this content to the archive with `filename` as the filename. - `filename` (String) Set this as the filename when declaring a `source`. - \ No newline at end of file + \ No newline at end of file