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

Powershell script downloads 32-bit version on non-English Windows versions #37

Closed
AdamMir86 opened this issue Nov 4, 2024 · 11 comments · Fixed by #38
Closed

Powershell script downloads 32-bit version on non-English Windows versions #37

AdamMir86 opened this issue Nov 4, 2024 · 11 comments · Fixed by #38
Assignees
Labels
bug Something isn't working

Comments

@AdamMir86
Copy link

AdamMir86 commented Nov 4, 2024

OpenTofu Version

OpenTofu v1.8.4 on windows_386

OpenTofu Configuration Files

not needed

Debug Output

  ╷
  │ Error: Plugin did not respond
  │
  │   with aws_efs_file_system.this,
  │   on main.tf line 1, in resource "aws_efs_file_system" "this":
  │    1: resource "aws_efs_file_system" "this" {
  │
  │ The plugin encountered an error, and failed to respond to the
  │ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
  │ details.
  ╵

  Stack trace from the terraform-provider-aws.exe plugin:

  panic: Error reading level state: strconv.ParseInt: parsing "2885974016": value out of range

  goroutine 77 [running]:
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0x255ad450, {0x256fdcf0, 0x1, 0x1}, 0x8)
        /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:556 +0x271
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).State(0x255ad450)
        /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:354 +0x47b
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ShimInstanceStateFromValue(0x259f73b0, {{{0x1918deb4, 0x256fcfe8}}, {0x152dcb80, 0x25fc0660}})
        /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:698 +0x1e8
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x2666e9f0, {0x1918dcd4, 0x25317b00}, 0x261e79e0)
        /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:682 +0x41f
  github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadResource(0x255ac230, {0x1918dcd4, 0x25317a40}, 0x261e79e0)
        /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ReadResource.go:35 +0x1d6
  github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x255ac500, {0x1918dcd4, 0x25317788}, 0x257007c0)
        /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x34f
  github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x16dc89e0, 0x255ac500}, {0x1918dcd4, 0x25317788}, 0x25700780, 0x0)
        /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:575 +0x98
  google.golang.org/grpc.(*Server).processUnaryRPC(0x25729188, {0x1918dcd4, 0x25317758}, {0x191cb2fc, 0x2521e6c8}, 0x24d90bb8, 0x266ca450, 0x22f63774, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1394 +0xfa0
  google.golang.org/grpc.(*Server).handleStream(0x25729188, {0x191cb2fc, 0x2521e6c8}, 0x24d90bb8)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1805 +0x10cf
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1029 +0x8a
  created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 84
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1040 +0x12f

  Error: The terraform-provider-aws.exe plugin crashed!

  This is always indicative of a bug within the plugin. It would be immensely
  helpful if you could report the crash with the plugin's maintainers so that it
  can be fixed. The output above should help diagnose the issue.

Expected Behavior

plan or apply should not end for error for existing EFS volume

Actual Behavior

15:44:07.979 STDOUT [eu-central-1\efs_bo] tofu: Planning failed. OpenTofu encountered an error while generating this plan.
15:44:07.979 STDOUT [eu-central-1\efs_bo] tofu:
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: ╷
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: │ Error: Plugin did not respond
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: │
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: │   with aws_efs_file_system.this,
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: │   on main.tf line 1, in resource "aws_efs_file_system" "this":
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: │    1: resource "aws_efs_file_system" "this" {
15:44:07.979 STDERR [eu-central-1\efs_bo] tofu: │
15:44:07.980 STDERR [eu-central-1\efs_bo] tofu: │ The plugin encountered an error, and failed to respond to the
15:44:07.980 STDERR [eu-central-1\efs_bo] tofu: │ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
15:44:07.980 STDERR [eu-central-1\efs_bo] tofu: │ details.

Steps to Reproduce

Switch on EFS module that so far was managed via Terraform

  1. run terragrunt run-all apply #while terraform 1.8.2 was installed
  2. uninstall terraform
  3. install opentofu
  4. run terragrunt run-all plan #to verify if ther are some issues
  5. run terragrunt run-all apply

Additional Context

I'm in process of migration from terraform to OpenTofu. As a overhead orchestration tool I use terragrunt (v 0.68.7 ).
Each projects code that i posses undergo same steps:

  1. run terragrunt run-all apply while terraform 1.8.2 was installed
  2. uninstall terraform
  3. install opentofu
  4. run terragrunt run-all plan to verify if ther are some issues
  5. run terragrunt run-all apply

Except changes from Terraform to OpenTofu, no other changes being made in such way.

On one project when Tofu is parsing existing tfstate file, I get constant error Error reading level state: strconv.ParseInt: parsing "2885974016": value out of range.

I Looked on that EFS volume and it's not so big slightly more then 2GB in size currently, the size of
value_in_ia (Infrequent Access storage class) is much grater then on other EFS that I use.
Im reluctant to manually edit tfstate, as probably it will help only once here.

Related tfstate file part that cause issue:

    {
      "mode": "managed",
      "type": "aws_efs_file_system",
...
            "size_in_bytes": [
              {
                "value": 2885974016,
                "value_in_ia": 2578825216,
                "value_in_standard": 307148800
              }
            ],

Note1: AWS EFS module used AWs module in version 5.50.0
Note2: removing AWS module limitation and upgrading it to 5.74.0 do not resolve issue

References

No response

@AdamMir86 AdamMir86 added the bug Something isn't working label Nov 4, 2024
@cam72cam
Copy link
Member

cam72cam commented Nov 4, 2024

This appears to be linked to hashicorp/terraform-plugin-sdk#1236. I think that resolves to https://github.com/hashicorp/terraform-plugin-sdk/blob/da29621efae69dd03dfdc540aa5f63beab1b764c/helper/schema/field_reader.go#L325 and https://pkg.go.dev/strconv#ParseInt. My understanding is that it defaults to trying to parse a 32-bit signed integer and the value provided is larger than that.

You are running OpenTofu on a 32-bit installation. Were you running terraform on a 64-bit installation? Did anything else change during your migration to OpenTofu?

@AdamMir86
Copy link
Author

Yes terraform was for 64bit, and I was pretty sure that OpenTofu was also in 64bit, as I used PowerShell script from documentation.
Let me install 64bit manually and recheck

@AdamMir86
Copy link
Author

That was it. So PowerShell script https://get.opentofu.org/install-opentofu.ps1 is installing 32bit version of Tofu on 64bit OS

@abstractionfactory
Copy link
Contributor

@AdamMir86 can you give me more information about your host OS? I have a Win 11 64-bit AMD and I can't reproduce the failure.

@AdamMir86
Copy link
Author

AdamMir86 commented Nov 4, 2024

Sure:

OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22631 N/A Build 22631
Processor(s):              1 Processor(s) Installed.
                           [01]: AMD64 Family 25 Model 33 Stepping 2 AuthenticAMD ~3401 Mhz

@abstractionfactory
Copy link
Contributor

@AdamMir86 I'm on build 26100, but I don't think that should make a difference. Could you run the script and paste the entire output here or send it over on the OpenTofu Slack please? Something is wrong here.

@abstractionfactory
Copy link
Contributor

Alternatively, could you please run the following in a PowerShell window?

(Get-CimInstance Win32_operatingsystem).OSArchitecture

@AdamMir86
Copy link
Author

I think issue is that i'm using Polish language, and output given for that command is:

PS C:\> (Get-CimInstance Win32_operatingsystem).OSArchitecture
64-bitowy

@AdamMir86
Copy link
Author

and full output from PS script:

.\install-opentofu.ps1 -installMethod standalone -skipVerify
OpenTofu Installer

Performing standalone installation to C:\Users\adamm\AppData\Local\Programs\OpenTofu...
WARNING: Signature verification is disabled. This is not recommended.
Determining latest OpenTofu version...
Latest OpenTofu version is 1.8.4.
Downloading OpenTofu version 1.8.4...
Downloading 2 files...
Downloading https://github.com/opentofu/opentofu/releases/download/v1.8.4/tofu_1.8.4_windows_386.zip to C:\Users\adamm\AppData\Local\Temp\tsg50udh.53k\tofu_1.8.4_windows_386.zip ...
Download of C:\Users\adamm\AppData\Local\Temp\tsg50udh.53k\tofu_1.8.4_windows_386.zip complete.
Downloading https://github.com/opentofu/opentofu/releases/download/v1.8.4/tofu_1.8.4_SHA256SUMS to C:\Users\adamm\AppData\Local\Temp\tsg50udh.53k\tofu_1.8.4_SHA256SUMS ...
Download of C:\Users\adamm\AppData\Local\Temp\tsg50udh.53k\tofu_1.8.4_SHA256SUMS complete.
Verifying checksum...
Checksums match.
Unpacking with current privileges...
Unpacking ZIP file to C:\Users\adamm\AppData\Local\Programs\OpenTofu...


    Directory: C:\Users\adamm\AppData\Local\Programs


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        04.11.2024     14:25                OpenTofu
Unzipping C:\Users\adamm\AppData\Local\Temp\tsg50udh.53k\tofu_1.8.4_windows_386.zip to C:\Users\adamm\AppData\Local\Programs\OpenTofu...
Updating user PATH variable...
Unpacking complete.
OpenTofu is now available at C:\Users\adamm\AppData\Local\Programs\OpenTofu\tofu.exe.

@abstractionfactory
Copy link
Contributor

abstractionfactory commented Nov 4, 2024

I think issue is that i'm using Polish language, and output given for that command is:

PS C:\> (Get-CimInstance Win32_operatingsystem).OSArchitecture
64-bitowy

😮 The output is language-dependent? That explains everything. Thank you @AdamMir86 !

@abstractionfactory abstractionfactory transferred this issue from opentofu/opentofu Nov 4, 2024
@abstractionfactory abstractionfactory changed the title [AWS EFS] Error reading level state: strconv.ParseInt: parsing "2885974016": value out of range Powershell script downloads 32-bit version on non-English Windows versions Nov 4, 2024
@abstractionfactory abstractionfactory self-assigned this Nov 4, 2024
@AdamMir86
Copy link
Author

Your welcome! Glad my issue had helped You a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants