Code Monkey home page Code Monkey logo

Comments (5)

rileykarson avatar rileykarson commented on June 1, 2024 1

Generally speaking, value out of range errors happen due to running on a 32-bit system....

A 32-bit system can only run a 32-bit binary but a 64-bit system can run either a 32-bit or 64-bit binary. This error generally happens when folks on an AMD64 system have accidentally installed an i386 binary- 32 bit systems are pretty rare nowadays.

The big trap causing this to happen is on https://developer.hashicorp.com/terraform/install which lists i386/ARM before AMD64/ARM64 (and happens most commonly on Windows, where package managers are less ubiquitious. although that's not the case here):

image

@bourdeau while your system is AMD64 as indicated by the x86_64 in your system version string, the Terraform binary you've downloaded is i386 (32-bit). In your original post see the results from terraform -v:

Terraform v1.6.6
on linux_386

For an AMD64 binary you'd expect linux_amd64. This is from my system where I'm using Terraform 1.5.2:

Terraform v1.5.2
on linux_amd64

You should be able to replace your binary w/ the AMD64 one.

from terraform-provider-google.

melinath avatar melinath commented on June 1, 2024

Generally speaking, value out of range errors happen due to running on a 32-bit system - here are some open (and closed) tickets with similar errors in the past: https://github.com/hashicorp/terraform-provider-google/issues?q=is%3Aissue+is%3Aopen+%22value+out+of+range%22

It's hard to tell from your config & debug log which resource this is related to - could you share a minimal config (without modules or variables and with the smallest number of resources possible) that reproduces the issue? Thanks!

from terraform-provider-google.

bourdeau avatar bourdeau commented on June 1, 2024

@melinath Thank you for your help

I use Terraform Cloud to store the state, but I execute terraform commands locally.

I'm on a 64bits machine (Linux ph-corsair 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux)

My project look like this:

.
├── docs
│   └── img
│       └── logo.jpg
├── environments
│   ├── preprod
│   │   └── main.tf
│   ├── prod
│   │   └── main.tf
│   └── test
│       └── main.tf
├── Makefile
├── modules
│   └── staysail
│       ├── bucket.tf
│       ├── cloud_run.tf
│       ├── database.tf
│       ├── dns.tf
│       ├── etc
│       │   └── env.tpl
│       ├── iam.tf
│       ├── lb.tf
│       ├── main.tf
│       ├── output.tf
│       ├── registry.tf
│       ├── secrets.tf
│       ├── service_account.tf
│       └── variables.tf
└── README.md

I tried to debug creating a new environment named test which contains exactly the same config as preprod:

terraform {
  required_version = ">= 1.6.6"
  cloud {
    organization = "staysail"

    workspaces {
      name = "test"
    }
  }
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "~> 5.9.0"
    }
    random = ">= 3.4.3"
  }
}


module "staysail" {
  source  = "../../modules/staysail"
  stage   = "test"
  is_prod = false
  db_settings = {
    tier              = "db-custom-1-3840"
    availability_type = "ZONAL"
    retained_backups  = 1
  }
  cr_api_settings = {
    cpu            = "1"
    memory         = "2048Mi"
    cpu_throttling = false
    min_scale      = "0"
    max_scale      = "1"
  }
  polaris_version = "latest"
}

The google-beta resources I use are the following:

resource "google_compute_region_network_endpoint_group" "serverless_neg" {
  project               = var.project
  provider              = google-beta
  name                  = "serverless-neg-${var.stage}"
  network_endpoint_type = "SERVERLESS"
  region                = var.region
  cloud_run {
    service = google_cloud_run_v2_service.polaris.name
  }
}

resource "google_artifact_registry_repository" "staysail" {
  provider               = google-beta
  count                  = var.is_prod ? 1 : 0
  location               = var.region
  repository_id          = "staysail"
  description            = "staysail Registery"
  format                 = "DOCKER"
  cleanup_policy_dry_run = false
  cleanup_policies {
    id     = "delete-week-old-latest"
    action = "DELETE"
    condition {
      tag_state  = "UNTAGGED"
      older_than = "604800s"
    }
  }
}

I also use Global HTTP Load Balancer Terraform Module for Serverless NEGs, which uses google-beta:

module "gce-lb-http" {
  source  = "GoogleCloudPlatform/lb-http/google//modules/serverless_negs"
  version = "~> 9.0"
  ...
}

terraform plan in the new testenvironment went absolutely fine. The bug only occurs in existing terraform states (prodand preprod).

The bug appeared after a terraform init -upgrade, no changes made.

I can push the full code on a public repo if it helps.

Edit: I'm sorry, I just realized I didn't post the issue on the google-beta repository. Do you want me to open it there?

from terraform-provider-google.

ggtisc avatar ggtisc commented on June 1, 2024

Hi @bourdeau if it is under your possibilities to share the full code please do it. Have you checked the past issues?
What are you trying to parse and where is it?

from terraform-provider-google.

rileykarson avatar rileykarson commented on June 1, 2024

I reworked #6518 into a canonical issue, deduplicating.

from terraform-provider-google.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.