From 45a681f1266bc2ce85ed7eab21f608c6269d450b Mon Sep 17 00:00:00 2001 From: Simao Gomes Viana Date: Wed, 14 Aug 2024 11:13:57 +0200 Subject: [PATCH] Extend documentation --- docs/resources/image.md | 6 +++--- examples/main.tf | 12 ++++++------ provider/resource_packer_image.go | 10 ++++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/resources/image.md b/docs/resources/image.md index da32865..de89c06 100644 --- a/docs/resources/image.md +++ b/docs/resources/image.md @@ -19,14 +19,14 @@ description: |- - `additional_params` (Set of String) Additional parameters to pass to Packer. Consult Packer documentation for details. Example: `additional_params = ["-parallel-builds=1"]` - `directory` (String) Working directory to run Packer inside. Default is cwd. -- `environment` (Map of String) Environment variables +- `environment` (Map of String) Environment variables to pass to Packer - `file` (String) Packer file to use for building - `force` (Boolean) Force overwriting existing images - `ignore_environment` (Boolean) Prevents passing all environment variables of the provider through to Packer - `name` (String) Name of this build. This value is not passed to Packer. -- `sensitive_variables` (Dynamic, Sensitive) Sensitive variables to pass to Packer (does the same as variables, but makes sure Terraform knows these values are sensitive) +- `sensitive_variables` (Dynamic, Sensitive) Sensitive variables to pass to Packer (does the same as variables, but makes sure Terraform knows these values are sensitive). Can contain following types: bool, number, string, list(string), set(string). - `triggers` (Map of String) Values that, when changed, trigger an update of this resource -- `variables` (Dynamic) Variables to pass to Packer +- `variables` (Dynamic) Variables to pass to Packer. Must be map or object. Can contain following types: bool, number, string, list(string), set(string). ### Read-Only diff --git a/examples/main.tf b/examples/main.tf index fe7f102..4e944f3 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -4,7 +4,7 @@ terraform { source = "toowoxx/packer" } random = { - source = "hashicorp/random" + source = "hashicorp/random" version = "3.6.2" } } @@ -73,7 +73,7 @@ resource "packer_image" "image2" { } resource "packer_image" "plugins_test" { - file = "tests/plugins.pkr.hcl" + file = "tests/plugins.pkr.hcl" force = true triggers = { packer_version = data.packer_version.version.version @@ -86,9 +86,9 @@ data "packer_files" "plugins" { resource "packer_image" "plugins_dir_test" { directory = "tests/plugins" - force = true + force = true environment = { - PACKER_LOG = "1" + PACKER_LOG = "1" PACKER_LOG_PATH = "/tmp/test-plugins-dir-packer.log" } triggers = { @@ -97,10 +97,10 @@ resource "packer_image" "plugins_dir_test" { } resource "packer_image" "log_output_test_17" { - file = "tests/17_log_output.pkr.hcl" + file = "tests/17_log_output.pkr.hcl" force = true environment = { - PACKER_LOG = "1" + PACKER_LOG = "1" PACKER_LOG_PATH = "/tmp/test-17-packer.log" } triggers = { diff --git a/provider/resource_packer_image.go b/provider/resource_packer_image.go index d1e50f6..e4fc777 100644 --- a/provider/resource_packer_image.go +++ b/provider/resource_packer_image.go @@ -82,12 +82,14 @@ func (r resourceImage) Schema(_ context.Context, _ resource.SchemaRequest, respo Optional: true, }, "variables": schema.DynamicAttribute{ - Description: "Variables to pass to Packer", - Optional: true, + Description: "Variables to pass to Packer. Must be map or object. " + + "Can contain following types: bool, number, string, list(string), set(string).", + Optional: true, }, "sensitive_variables": schema.DynamicAttribute{ Description: "Sensitive variables to pass to Packer " + - "(does the same as variables, but makes sure Terraform knows these values are sensitive)", + "(does the same as variables, but makes sure Terraform knows these values are sensitive). " + + "Can contain following types: bool, number, string, list(string), set(string).", Sensitive: true, Optional: true, }, @@ -110,7 +112,7 @@ func (r resourceImage) Schema(_ context.Context, _ resource.SchemaRequest, respo Optional: true, }, "environment": schema.MapAttribute{ - Description: "Environment variables", + Description: "Environment variables to pass to Packer", ElementType: types.StringType, Optional: true, },