-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
google_compute_attached_disk failing for zone #16265
google_compute_attached_disk failing for zone #16265
Comments
@nikeshp1 I do not see a change in google_compute_attached_disk in 4.84.0. The issue could be in other resources. Can you share a config that I can use to repro the issue? Also please share the full debug log that contains the api requests and responses. |
i had same issue on google_compute_attached_disk current workaround is adding zone at the resource block :
the documentation should be updated to add the zone |
I also have the same issue. I cannot apply the workaround listed by @rvnz45 as it will effect all my existing disks on compute instances already spun up via terraform. |
@addyb77 @rvnz45 @nikeshp1 tested upgrading from v4.80.0 to v5.0.0 with below config, I did not hit a problem. Anyone of you can provide a config and steps that I can follow to repro? resource "google_compute_attached_disk" "default" {
disk = google_compute_disk.default.id
instance = google_compute_instance.default.id
}
resource "google_compute_instance" "default" {
name = "issue16265"
machine_type = "e2-medium"
zone = "us-west1-a"
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
}
}
network_interface {
network = "default"
}
lifecycle {
ignore_changes = [attached_disk]
}
}
resource "google_compute_disk" "default" {
name = "issue16265-disk"
type = "pd-ssd"
zone = "us-west1-a"
image = "debian-11-bullseye-v20220719"
physical_block_size_bytes = 4096
}
terraform {
required_providers {
google = {
version = "~> 5.0.0"
#version = "~> 4.84.0"
#version = "~> 4.80.0"
}
google-beta = {
version = "~> 5.0.0"
#version = "~> 4.84.0"
#version = "~> 4.80.0"
}
}
} |
Hi @edwardmedia, XXXXXXXX@XXXXXXXX manual % terraform init -upgrade Initializing the backend... Initializing provider plugins...
Terraform has made some changes to the provider dependency selections recorded Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see If you ever set or change modules or backend configuration for Terraform, Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
Terraform will perform the following actions: google_compute_attached_disk.default will be created
google_compute_disk.default will be created
google_compute_instance.default will be created
Plan: 3 to add, 0 to change, 0 to destroy. ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
Your version of Terraform is out of date! The latest version Initializing the backend... Initializing provider plugins...
Terraform has made some changes to the provider dependency selections recorded Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see If you ever set or change modules or backend configuration for Terraform, Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
Terraform planned the following actions, but then encountered a problem: google_compute_disk.default will be created
google_compute_instance.default will be created
Plan: 2 to add, 0 to change, 0 to destroy. ╵XXXXX@XXXXX manual % terraform --version
Your version of Terraform is out of date! The latest version Code:
Btw, this is the test code, in prod we are using instance template and instance from template which has similar error attaching disk |
Here is the error log with log at debug level " tf_proto_version=5.3 tf_rpc=PlanResourceChange @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR tf_provider_addr=registry.terraform.io/hashicorp/google tf_req_id=cc5a9de5-58ec-0853-3b28-7e3ec9df897c tf_resource_type=google_compute_attached_disk timestamp=2023-10-19T14:42:20.774-0400 |
FYI, this issue is when we don't provide zone explicitly to "google_compute_attached_disk" or zone is not configured in the provider. |
Exactly my issue. We use terragrunt on top of Terraform and for us to
change if in the module would cause havoc to other resources. I tried
adding the zone to the input block for the attached disk in Terragrunt but
got the same error.
…On Thu, 19 Oct 2023, 20:45 nikeshp1, ***@***.***> wrote:
FYI, this issue is when we don't provide zone explicitly to
"google_compute_attached_disk" or zone is not configured in the provider.
We cannot set the zone in the provider as we are deploying resources in
multiple zones
—
Reply to this email directly, view it on GitHub
<#16265 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE5BXWPVFBE3AV5ZJKI3M5DYAF7PBAVCNFSM6AAAAAA6CX6HIKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGYYDKOBUHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Oh I see. This error actually only happens for a fresh plan/apply with v5.x. It is fine when the config was first applied with v4.x and then upgrade with |
Hi, |
The issue appears to be related to the introduction of DefaultProviderZone by v5.x |
Is there any update on this issue? I have attempted to create a new compute module for testing and even with hardcoding the zone at the module level, i still get the same error: *** Failed to retrieve zone, pid: , err: zone: required field is not set** |
@NickElliot , |
I've been implementing the update test for this issue between other work that made me busy last week, if it's merged by EOD it would be released next monday, otherwise will be the monday after that. There are no plans to implement a patch. |
@NickElliot, |
It was merged on Thurs the 9th which is after the deadline for the release made yesterday. It should be a part of the release on the 20th. |
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. |
GCP VM proivisioning is failing and as workaround using 4.83.0.
Error is Failed to retrieve zone, pid: , err: zone: required field is not set for resource "google_compute_attached_disk"
Logs during the tf execution
18:08:49 Error: 1 error occurred:
18:08:49 * Failed to retrieve zone, pid: , err: zone: required field is not set
18:08:49
18:08:49
18:08:49
18:08:49 on ../../../modules/google/tf_12/virtual-machine/main.tf line 168, in resource "google_compute_attached_disk" "disk_attachment":
18:08:49 168: resource "google_compute_attached_disk" "disk_attachment" {
The code is
resource "google_compute_attached_disk" "disk_attachment" {
for_each = local.disks_merged
disk = google_compute_disk.data_disk[each.key].id
device_name = each.value.device_name
instance = google_compute_instance_from_template.vm_instances[each.value.hostname].id
}
The same code was working until 4.83.0 and started failing from 4.84.0
Per the latest documentation as well, the zone is not a mandatory attribute and is extracted from the instance_id self link
The text was updated successfully, but these errors were encountered: