Skip to content

archive not being able to determine value #468

@tomasbackman

Description

@tomasbackman

Terraform CLI and Provider Versions

Terraform v1.5.7

  • provider registry.terraform.io/hashicorp/archive v2.7.1
  • provider registry.terraform.io/hashicorp/google v7.5.0
  • provider registry.terraform.io/hashicorp/google-beta v7.5.0

Terraform Configuration

Copied and edited relevant config  
with providers above, the below code should make it reproducible)


### Module: cloud_function_automation
variable "function_name" {
  description = "The name also need to correspond to a folder with the scripts for the function."
  type        = string
}
variable "function_bucket" {
  description = "The bucket where the functions should be stored in gcp."
  type        = string
}
# Create a zip file from function folder
resource "archive_file" "function_zip" {
  type = "zip"
  # The folder/files source are located in the gitlab job workdir
  #   terraform root is in <gitlab job workdir>/.terraform/modules/<module_name>/
  source_dir  = "${path.root}/../../../${var.function_name}"
  output_path = "${path.root}/${var.function_name}.zip"
}
# Upload zip file to given functions bucket
resource "google_storage_bucket_object" "function_obj" {
  name   = "${path.root}/${var.function_name}.zip"
  bucket = var.function_bucket
  source = resource.archive_file.function_zip.output_path
}

### Config main
locals {
envs = ["Sandbox"]
}

module automation {
  for_each = toset(local.envs)
  source          = cloud_function_automation
  function_name   = "my_function_folder"
  function_bucket = "my_bucket"
}

Expected Behavior

Zip file created and uploaded to gcs bucket

Actual Behavior

terraform plan worked fine,
but the terraform apply gives several (for all archive outputs .id, .output_base64sha256, output_base64sha512 etc .:

Error: Provider returned invalid result object after apply

│ After the apply operation, the provider still indicated an unknown value
│ for module.my_mod["sandbox"].archive_file.function_zip.id. All
│ values must be known after apply, so this is always a bug in the provider
│ and should be reported in the provider's own repository. Terraform will
│ still save the other known object values in the state.

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

High

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