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

aws_s3_bucket_object etag returns providers bug error #9575

Closed
ghost opened this issue Jul 31, 2019 · 4 comments
Closed

aws_s3_bucket_object etag returns providers bug error #9575

ghost opened this issue Jul 31, 2019 · 4 comments
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/s3 Issues and PRs that pertain to the s3 service.

Comments

@ghost
Copy link

ghost commented Jul 31, 2019

This issue was originally opened by @vasilij-icabbi as hashicorp/terraform#22273. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.5
+ provider.aws v2.21.1
+ provider.null v2.1.2

I have a null_resource that runs a bash script locally to create a zip file:

resource "null_resource" "package_lambda" {

  triggers = {
    build_number = timestamp()
  }

  provisioner "local-exec" {
    command = "bin/package-lambda"
    interpreter = ["bash"]
  }
}

Than I have aws_s3_bucket_object resource that puts created zip file onto S3:

resource "aws_s3_bucket_object" "rss" {

  depends_on = [
    null_resource.package_lambda
  ]

  bucket = aws_s3_bucket.lambda_packages_storage.bucket
  key    = format("lambdas/%s/function.zip", local.lambdas.rss.function_name)
  source = local.lambdas.rss.path_to_file

  acl = "private"

  etag = md5(filebase64(local.lambdas.rss.path_to_file))
}

When I run terraform apply I get following error:

Error: Provider produced inconsistent final plan

When expanding the plan for aws_s3_bucket_object.rss to include new
values learned so far during apply, provider "aws" produced an invalid new
value for .etag: was cty.StringVal("92026b29f59b68ccc930d007b67b1a3b"), but
now cty.StringVal("563744635d84d0506cafce7111c9ae52").

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Is there a workaround to this issues? Thank you.

@ghost ghost added the service/s3 Issues and PRs that pertain to the s3 service. label Jul 31, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 31, 2019
@frediana
Copy link
Contributor

Hello I have the same issue, any possible workaround for this issue?

thx

@lambertpan
Copy link

I fixed this by using null_resource_id, example etag = null_resource.package_lambda.id

@breathingdust breathingdust added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 27, 2020
@YakDriver
Copy link
Member

I recommend using the source_hash argument instead. See #11522.

@github-actions
Copy link

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 Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

No branches or pull requests

4 participants