Open luciahouse33 opened 5 days ago
Hi @luciahouse33!
I tried to replicate this issue but the result after a terraform apply
was Successfully without errors
.
I noticed that your environment variable "source_code_path" = "./scripts/cloud-functions/obtain_raw_data"
doesn't have the extention for the file(oject) you are looking to upload. Even if you are using content_type it is necessary to put this value on the source as you can see in the most basic example of google_storage_bucket_object
in terraform registry
Due to we don't have access to the data "archive_file" "source_code"
and the content of the obtain_raw_data
we are sharing you the official links with all the information and additionally here is the used code to replicate this issue:
provider "google" {
user_project_override = true
billing_project = "my-project"
project = "my-project"
}
terraform {
required_providers {
google = {
source = "hashicorp/google-beta"
version = "5.35.0"
}
}
}
resource "google_storage_bucket" "bucket_18618" {
name = "bucket-18618"
location = "US"
}
resource "google_storage_bucket_object" "bo_18618" {
source = "./utils/bucket_objects/index.zip"
name = "bo_18618"
bucket = google_storage_bucket.bucket_18618.name
content_type = "application/zip"
}
The index.zip file contains a index.js file with the next code:
exports.helloGET = (req, res) => {
res.status(200).send('Hello world!');
};
I suggest you to check your project configuration, environment variables, zip file content and execute the process with a simplified example to test your code after including data blocks, modules, environment variables and locals and when everything is ok you can continue with your current configuration.
If you continue having problems, share the code and the missing data with us. You can change sensitive data block with examples like: project = "my-project" org_id = 1234567890 iam_user = "my-user@my-domain.com"
Community Note
Terraform Version & Provider Version(s)
Terraform v1.5.7 on linux_amd65
Affected Resource(s)
google_storage_bucket_object
Terraform Configuration
where vars are like:
Debug Output
No response
Expected Behavior
Update can be applied
Actual Behavior
Intermittently, the following error happens
To resolve as a work around, I have commented out the resources and re-added them after an intermediate deployment.
Steps to reproduce
terraform plan
(runs successfully)terraform apply
Important Factoids
In the terraform plan, for the resource with the issue, I see the following:
I have seen this twice with the terraform provider 5.35.0. When I have downgraded, and run ~6 updates, I do not see this happen. With it being intermittent, it is hard to fully test.
References
No response