astronomer / terraform-provider-astro

Astro Terraform Provider
https://registry.terraform.io/providers/astronomer/astro/latest
Other
11 stars 4 forks source link

[Bug]: Unable to set Hibernation schedule #153

Closed blaivs closed 1 month ago

blaivs commented 1 month ago

Description

While trying to set an hibernation schedule for a development deployment it fails with:

│ Error: scaling_spec (hibernation) is only supported for is_development_mode set to true
│ 
│   with module.astronomer.module.workspaces.astro_deployment.test,
│   on astronomer/workspace/main.tf line 20, in resource "astro_deployment" "test":
│   20: resource "astro_deployment" "test" {
│ 
│ Either set is_development_mode to true or remove scaling_spec

I'm using provider version 1.0.0.

Steps To Reproduce

Define a deployment in a workspace, with is_development_mode: true and hibernation schedule:

resource "astro_cluster" "this" {
  type             = "DEDICATED"
  name             = "test"
  region           = "eu-west-1"
  cloud_provider   = "AWS"
  vpc_subnet_range = "10.0.0.0/20"
  workspace_ids    = []
}

resource "astro_workspace" "this" {
  name                  = "test"
  cicd_enforced_default = true
  description           = "A workspace for testing"
}

resource "astro_deployment" "test" {
  name                    = "test"
  description             = "A Kubernetes deployment"
  type                    = "DEDICATED"
  executor                = "KUBERNETES"
  cluster_id              = astro_cluster.this.id
  workspace_id            = astro.workspace.this.id
  contact_emails          = ["example@example.org"]

  is_development_mode     = true
  scaling_spec = {
    hibernation_spec = {
      schedules = [{
        is_enabled : true
        hibernate_at_cron : "0 17 * * 1-5"
        wake_at_cron : "0 6 * * 1-5"
      }]
    }
  }
  is_dag_deploy_enabled = false
  is_high_availability = false
  is_cicd_enforced = false

  resource_quota_cpu      = "10"
  resource_quota_memory   = "20Gi"
  scheduler_size          = "SMALL"
  default_task_pod_cpu    = "0.25"
  default_task_pod_memory = "0.5Gi"

  environment_variables = [ ]
}

Acceptance Criteria

Anything else?

No response

blaivs commented 1 month ago

Looks like I had an error on my code! Works as expected!