Skip to content

Commit

Permalink
change NOT to NOT_IN for node_affinities operator (#3225) (#5841)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Mar 5, 2020
1 parent 43c46a8 commit 1af6072
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/3225.txt
Original file line number Diff line number Diff line change
@@ -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`.
```
2 changes: 1 addition & 1 deletion google/compute_instance_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions google/resource_compute_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_instance_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 1af6072

Please sign in to comment.