diff --git a/.changelog/3225.txt b/.changelog/3225.txt new file mode 100644 index 0000000000..ba968e8182 --- /dev/null +++ b/.changelog/3225.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed bug where `google_compute_instance.scheduling.node_affinities.operator` would incorrectly accept `NOT` rather than `NOT_IN`. +``` diff --git a/google-beta/compute_instance_helpers.go b/google-beta/compute_instance_helpers.go index ba9ab707e5..f1cfc93480 100644 --- a/google-beta/compute_instance_helpers.go +++ b/google-beta/compute_instance_helpers.go @@ -22,7 +22,7 @@ func instanceSchedulingNodeAffinitiesElemSchema() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"IN", "NOT"}, false), + ValidateFunc: validation.StringInSlice([]string{"IN", "NOT_IN"}, false), }, "values": { Type: schema.TypeSet, diff --git a/google-beta/resource_compute_instance_test.go b/google-beta/resource_compute_instance_test.go index e6d4eb4e2b..3e728d5112 100644 --- a/google-beta/resource_compute_instance_test.go +++ b/google-beta/resource_compute_instance_test.go @@ -4240,6 +4240,12 @@ resource "google_compute_instance" "foobar" { values = ["test"] } + node_affinities { + key = "tfacc" + operator = "NOT_IN" + values = ["not_here"] + } + node_affinities { key = "compute.googleapis.com/node-group-name" operator = "IN" @@ -4302,6 +4308,12 @@ resource "google_compute_instance" "foobar" { values = ["test", "updatedlabel"] } + node_affinities { + key = "tfacc" + operator = "NOT_IN" + values = ["not_here"] + } + node_affinities { key = "compute.googleapis.com/node-group-name" operator = "IN" diff --git a/website/docs/r/compute_instance.html.markdown b/website/docs/r/compute_instance.html.markdown index 4337d858fd..093d4cd5f9 100644 --- a/website/docs/r/compute_instance.html.markdown +++ b/website/docs/r/compute_instance.html.markdown @@ -333,7 +333,7 @@ The `node_affinities` block supports: * `key` (Required) - The key for the node affinity label. * `operator` (Required) - The operator. Can be `IN` for node-affinities - or `NOT` for anti-affinities. + or `NOT_IN` for anti-affinities. * `value` (Required) - The values for the node affinity label. diff --git a/website/docs/r/compute_instance_template.html.markdown b/website/docs/r/compute_instance_template.html.markdown index d6318fad75..f304967080 100644 --- a/website/docs/r/compute_instance_template.html.markdown +++ b/website/docs/r/compute_instance_template.html.markdown @@ -394,7 +394,7 @@ The `node_affinities` block supports: * `key` (Required) - The key for the node affinity label. * `operator` (Required) - The operator. Can be `IN` for node-affinities - or `NOT` for anti-affinities. + or `NOT_IN` for anti-affinities. * `value` (Required) - The values for the node affinity label.