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

google_os_config_os_policy_assignment failure on Windows #12077

Closed
DmitriSmirnovCTL opened this issue Jul 11, 2022 · 9 comments
Closed

google_os_config_os_policy_assignment failure on Windows #12077

DmitriSmirnovCTL opened this issue Jul 11, 2022 · 9 comments
Assignees
Labels

Comments

@DmitriSmirnovCTL
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.2.4
on windows_386

  • provider registry.terraform.io/hashicorp/google v4.28.0

Affected Resource(s)

  • google_os_config_os_policy_assignment

Terraform Configuration Files

resource "google_os_config_os_policy_assignment" "fireeyehx-agent-windows" {
  description		= "OSConfig policy for FireEye HX agent"
  project		= "terraform123"

  rollout {
    disruption_budget {
      fixed = 1
    }
    min_wait_duration = "15s"
  }

  instance_filter {
    all = false

    inventories {
      os_short_name = "windows"
    }
  }

  location = "us-central1-a"


  name = "fireeyehx-agent-windows"

  os_policies {
    id   = "policy"
    mode = "ENFORCEMENT"

    resource_groups {

      resources {
        id = "install-msi"

        pkg {
          desired_state = "INSTALLED"

          msi {
            source {
              gcs {
                bucket     = "dstest-public-repository"
                object     = "xagtSetup_33.46.3_universal.msi"
                generation = 1633065744445004
              }
            }
            properties = ["CONFJSONDIR='c:/windows/temp'"]
          }
        }
      }

     }
  }
}

Debug Output

https://gist.github.com/DmitriSmirnovCTL/f7c460bb013d30929542564278e4b234

Panic Output

Expected Behavior

Related terraform works fine from CloudShell and MacOS but fails for terraform on Windows

Actual Behavior

Code deploys OSConfig policy in specified project/zone. Works on MacOS, fails on Windows

Steps to Reproduce

  1. terraform plan

Important Factoids

References

  • #0000
@edwardmedia edwardmedia self-assigned this Jul 11, 2022
@edwardmedia
Copy link
Contributor

@DmitriSmirnovCTL I am able to create the fireeyehx-agent-windows using your code without issue. The Error from your log was complaining on the field of generation Where did you run the code?

@DmitriSmirnovCTL
Copy link
Author

Code works for me on MacOS and CloudShell but fails on Windows 10 and Window 2022

@edwardmedia
Copy link
Contributor

edwardmedia commented Jul 11, 2022

@DmitriSmirnovCTL I was using the very your code. I saw the resource was created. Not sure what was wrong with yours. It appears the terraform fails at the precheck stage which has not launch api calls yet. Are you able to run the code for Windows at the GCP Cloudshell?

@DmitriSmirnovCTL
Copy link
Author

Correct, it fails on precheck stage if terraform executed on Windows OS. Were you able to deploy from Windows-based machine? The code is part of custom project template on my side. I can deploy projects myself from MacOS but have users with terraform deployed on Windows machines and code fails for them. I did reproduce the failure from Windows 2022-based machine too.

@slevenick
Copy link
Collaborator

Looks like a conversion issue on the generation number? My first guess is that it's too large for the windows architecture you're on to handle, so TF converts it?
│ Error: Attribute must be a whole number, got 1.633065744445004e+15

If the error happens when running Terraform on windows but not for the same config file on MacOS, the problem is likely not in the provider. I may direct you to either Terraform core or the SDK directly.

What version of Terraform are you running?

@DmitriSmirnovCTL
Copy link
Author

Terraform version: v1.2.4

@slevenick
Copy link
Collaborator

Talked to some people on the SDK team, I think the issue is at the SDK level.

Can you confirm if you're on a 32-bit version of windows? And if so, can you try on a 64-bit version and see if it solves the issue?

@DmitriSmirnovCTL
Copy link
Author

Thank you, we were using 64-bit Windows machines and 32-bit terraform binary. Switched to 64-bit terraform binary and was able to pre-check and deploy.

@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 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants