Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"object required, but received dynamic" error when applying terraform_data resource #32985

Closed
kangkyu opened this issue Apr 5, 2023 · 1 comment · Fixed by #32988
Closed
Assignees

Comments

@kangkyu
Copy link

kangkyu commented Apr 5, 2023

Terraform Version

$ terraform version
Terraform v1.4.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/archive v2.3.0
+ provider registry.terraform.io/hashicorp/aws v4.61.0
+ provider registry.terraform.io/hashicorp/random v3.4.3

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.61"
    }
    random = {
      source  = "hashicorp/random"
      version = "~> 3.4.3"
    }
    archive = {
      source  = "hashicorp/archive"
      version = "~> 2.3.0"
    }
  }

  backend "local" {
    path = "terraform.tfstate"
  }

  required_version = "1.4.4"
}

resource "terraform_data" "lambda_build" {
  triggers_replace = [
    filemd5("./product/main.go")
  ]

  provisioner "local-exec" {
    command     = "GOOS=linux GOARCH=amd64 go build -o ./bin/aws-lambda-go -C ./product"
    working_dir = path.module
  }
}

data "archive_file" "zip" {
  type        = "zip"
  source_file = "bin/aws-lambda-go"
  output_path = "aws-lambda-go.zip"
  depends_on  = [terraform_data.lambda_build]
}

Debug Output

https://gist.github.com/kangkyu/f41bfe90f6b3fbefb03af45f077d56b9

Expected Behavior

terraform apply should apply code change without errors

Actual Behavior

╷
│ Error: Provider produced invalid object
│ 
│ Provider "provider[\"terraform.io/builtin/terraform\"]" produced an invalid value after
│ apply for terraform_data.lambda_build: object required, but received dynamic. The
│ result cannot not be saved in the Terraform state.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue
│ tracker.
╵

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

I have run it on local

References

No response

@kangkyu kangkyu added bug new new issue not yet triaged labels Apr 5, 2023
@jbardin jbardin self-assigned this Apr 5, 2023
@jbardin jbardin added core and removed new new issue not yet triaged labels Apr 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants