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

Issue with google_compute_instance->scheduling->node_affinities->operator #5823

Closed
jsfrerot opened this issue Mar 4, 2020 · 6 comments · Fixed by GoogleCloudPlatform/magic-modules#3225 or #5841

Comments

@jsfrerot
Copy link

jsfrerot commented Mar 4, 2020

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 v0.12.21

Affected Resource(s)

  • google_compute_instance

Terraform Configuration Files

resource "google_compute_instance" "master" {
...
  scheduling {
    node_affinities {
      key = var.cluster_name
      operator = "NOT"
      values = [var.cluster_name]
    }
  }
...
}

Expected Behavior

Accept gcp api values (IN and NOT)

Actual Behavior

When using "NOT"


  on .terraform/modules/gce_mariadb_lunashared_dsm_sand/main.tf line 1, in resource "google_compute_instance" "master":
   1: resource "google_compute_instance" "master" {

Steps to Reproduce

  1. terraform apply

Important Factoids

Module should comply with https://cloud.google.com/compute/docs/nodes/create-nodes

  • #0000
@ghost ghost added the bug label Mar 4, 2020
@edwardmedia edwardmedia self-assigned this Mar 4, 2020
@edwardmedia
Copy link
Contributor

@jsfrerot you don't have other code which makes a little hard to investigate. Could you please post complete code along with the full debug log? Thanks

@jsfrerot
Copy link
Author

jsfrerot commented Mar 4, 2020

@ghost ghost removed the waiting-response label Mar 4, 2020
@edwardmedia
Copy link
Contributor

@jsfrerot can you replace ǸOT by NOT_IN. Here is the reference from API
https://cloud.google.com/compute/docs/reference/rest/v1/instances/setScheduling.
Let me know if this helps address your issue. In the meantime, I change the issue form bug to document

@jsfrerot
Copy link
Author

jsfrerot commented Mar 5, 2020

I'm getting the following error with "NOT_IN"

Error: expected scheduling.0.node_affinities.0.operator to be one of [IN NOT], got NOT_IN

  on .terraform/modules/gce_mariadb_lunashared_dsm_sand/main.tf line 6, in resource "google_compute_instance" "master":
   6: resource "google_compute_instance" "master" {

@edwardmedia
Copy link
Contributor

@jsfrerot yeah this is a bug in the validation. I am going to reset it to bug. Thank you for reporting it. We will get it fixed as soon as we can.

			"operator": {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringInSlice([]string{"IN", "NOT"}, false),
			},

https://github.com/terraform-providers/terraform-provider-google/blob/master/google/compute_instance_helpers.go#L13:6

@ghost
Copy link

ghost commented Apr 5, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.