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

Newly created google_compute_autoscaler has always default min_replicas #4832

Closed
tomplus opened this issue Nov 7, 2019 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#2632
Assignees
Labels

Comments

@tomplus
Copy link

tomplus commented Nov 7, 2019

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.5

  • provider.archive v1.3.0
  • provider.google v2.19.0
  • provider.google-beta v2.19.0
  • provider.random v2.2.1

Affected Resource(s)

  • google_compute_autoscaler

Terraform Configuration Files

resource "google_compute_autoscaler" "test" {
  provider = "google-beta"
  name     = "test"
  target   = "${google_compute_instance_group_manager.test.self_link}"
  zone     = var.zone
  project  = var.project

  autoscaling_policy {
    max_replicas    = 6
    min_replicas    = 0
    cooldown_period = 60

    metric {
      name                       = "pubsub.googleapis.com/subscription/num_undelivered_messages"
      filter                     = "resource.label.subscription_id = \"${var.queue_name}\" AND resource.type = \"pubsub_subscription\""
      single_instance_assignment = 1
    }
  }
}

Expected Behavior

The created resource should have min_replicas = 0.

Actual Behavior

The resource has min_replicas = 2 after creation. I have to run terraform apply again to fix this parameter.

      ~ autoscaling_policy {
            cooldown_period = 60
            max_replicas    = 6
          ~ min_replicas    = 2 -> 0

Steps to Reproduce

  1. terraform apply
@tomplus
Copy link
Author

tomplus commented Nov 10, 2019

Thank you.

@hixus
Copy link

hixus commented Nov 13, 2019

Have the same issue. Running with TF_LOG=true it seems that terraform drops minNumReplicas from POST request if it's set to zero. Therefore autoscaler selects some minimum other than zero. Below post request body terraform made.

[DEBUG] plugin.terraform-provider-google-beta_v2.19.0_x4:
{
  "autoscalingPolicy": {
   "coolDownPeriodSec": 60,
   "customMetricUtilizations": [
    {
     "filter": "resource.type = pubsub_subscription AND resource.label.subscription_id = foobar",
     "metric": "pubsub.googleapis.com/subscription/num_undelivered_messages",
     "singleInstanceAssignment": 100
    }
   ],
   "maxNumReplicas": 1
  },
  "name": "foobar",
  "target": "https://www.googleapis.com/compute/beta/projects/foobar/zones/europe-north1-a/instanceGroupManagers/foobar-igm",
  "zone": "projects/foobar-258114/global/zones/europe-north1-a"
}```

@hixus
Copy link

hixus commented Nov 13, 2019

Ok, this seems to be fixed but when does the fix come out?

@danawillow
Copy link
Contributor

v2.20 (probably tomorrow)

@ghost
Copy link

ghost commented Dec 9, 2019

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

Successfully merging a pull request may close this issue.

3 participants