Skip to content

Issue archiving base64 encoded content w/ source blockΒ #149

@lineardraft

Description

@lineardraft

Terraform CLI and Provider Versions

Terraform v1.2.3
on darwin_amd64

  • provider registry.terraform.io/hashicorp/archive v2.2.0

Terraform Configuration

data "archive_file" "input_archive" {
  type        = "zip"
  source_file = "${path.module}/input.file"
  output_path = "${path.module}/files/input.zip"
}

data "archive_file" "output_archive" {
  type        = "zip"
  output_path = "${path.module}/files/output.zip"

  source {
    content = filebase64(data.archive_file.input_archive.output_path)
    filename = "${data.archive_file.input_archive.output_path}"
  }
}

Expected Behavior

Just for the sake of producing an working bug in the Terraform configuration we have the following:

  1. First "archive_file" creates a dummy archive 'input.zip' based on 'input.file'
  2. Second "archive_file" creates an 'output.zip' w/ base64 contents of 'input.zip' archive (since it's a binary file using filebase64 function)

Expected behaviour is that the input.zip archive that is archived within output.zip archive is valid and extractable.

Actual Behavior

When 'output.zip' archive is extracted, 'input.zip' is present but it's not extractable. Upon closer inspection it seems that it's still base64 encoded.

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions