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

Support optional vm_count for google_compute_resource_policy.group_placement_policy when collocation="COLLOCATED" #11483

Closed
Milestone

Comments

@nick-stroud
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 -v
Terraform v1.1.5
on linux_amd64

Affected Resource(s)

  • google_compute_resource_policy

Terraform Configuration Files

resource "google_compute_resource_policy" "placement_policy" {
  name   = "my-placement-policy"
  region = "us-central1"
  group_placement_policy {
    collocation = "COLLOCATED"
  }
}

Expected Behavior

The resource policy should be created without a vm_count as described in the official documentation: https://cloud.google.com/compute/docs/instances/define-instance-placement#compact.

Actual Behavior

Terraform fails because vm_count is not specified.

$ terraform apply
╷
│ Error: Missing required argument
│ 
│   with google_compute_resource_policy.placement_policy,
│   on main.tf line 4, in resource "google_compute_resource_policy" "placement_policy":
│    4:   group_placement_policy {
│ 
│ "group_placement_policy.0.availability_domain_count": one of `group_placement_policy.0.availability_domain_count,group_placement_policy.0.vm_count` must be specified
╵
╷
│ Error: Missing required argument
│ 
│   with google_compute_resource_policy.placement_policy,
│   on main.tf line 4, in resource "google_compute_resource_policy" "placement_policy":
│    4:   group_placement_policy {
│ 
│ "group_placement_policy.0.vm_count": one of `group_placement_policy.0.availability_domain_count,group_placement_policy.0.vm_count` must be specified
╵

Important Factoids

  • The actual behavior is in line with the provider documentation but is enforcing a limitation that goes against the recommendation of the GCP documentation (See note in this section)
  • The equivelent gcloud command succeeds (note lack of --vm-count argument):
gcloud compute resource-policies create group-placement my-placement-policy \
    --collocation COLLOCATED \
    --region us-central1 \
    --project <project-id>
@melinath
Copy link
Collaborator

This looks like it's probably a valid enhancement request; I don't think it's a bug, since the provider is behaving as expected (and if it's a bug it's probably a persistent bug, which would be treated as an enhancement request). It looks like gcloud made --vm-count optional in 2020-03. And according to the API user guide it is possible to exclude the field (even though it's not marked optional in the API reference.

Currently vmCount and availabilityDomainCount are marked as at_least_one_of; it might be as simple as changing that to conflicts_with and marking them as optional, but I'm not sure. The logic of which subfields have to be specified and what behavior is expected if they aren't seems to also be influenced by the collocation field.

@melinath melinath added enhancement and removed bug labels Apr 14, 2022
@melinath melinath changed the title google_compute_resource_policy incorrectly requires vm_count when used with "COLLOCATED" Support optional vm_count for google_compute_resource_policy.group_placement_policy when collocation="COLLOCATED" Apr 14, 2022
@rileykarson rileykarson added this to the Goals milestone Apr 18, 2022
@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 Nov 17, 2022
@github-actions github-actions bot added forward/review In review; remove label to forward service/compute-instances labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.