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

Allow dynamic isDevelopmentMode for deployment resource #173

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

vandyliu
Copy link
Collaborator

Description

Customer wants to use isDevelopmentMode dynamically like so:

resource "astro_deployment" "team_1_dev_deployment" {
#     original_astro_runtime_version = "11.3.0"
  name                    = "team-1-dev-deployment3"
  description             = "Team 1 Dev Deployment"
  type                    = "STANDARD"
  cloud_provider          = "AWS"
  region                  = "us-east-1"
  contact_emails          = []
  default_task_pod_cpu    = "0.25"
  default_task_pod_memory = "0.5Gi"
  executor                = "CELERY"
  is_cicd_enforced        = true
  is_dag_deploy_enabled   = true
  is_development_mode     = var.environment_name == "prd" ? true : false
  is_high_availability    = false
  resource_quota_cpu      = "10"
  resource_quota_memory   = "20Gi"
  scheduler_size          = "SMALL"
  workspace_id            = astro_workspace.team_1_workspace.id
  environment_variables   = []
  worker_queues = [{
    name               = "default"
    is_default         = true
    astro_machine      = "A5"
    max_worker_count   = 10
    min_worker_count   = 0
    worker_concurrency = 1
  }]
  scaling_spec = var.environment_name == "prd" ? null : {
    hibernation_spec = {
      schedules = [{
        hibernate_at_cron    = "1 * * * *"
        is_enabled           = true
        wake_at_cron         = "59 * * * *"
      }]
    }
  }
}


variable "environment_name" {
  type    = string
  default = "prd"
}

Our static validation does not allow this so I removed it.

🧪 Functional Testing

  • Tested with isDevelopmentMode = [true, false] and scalingSpec = [null, ]
  • The only case that correctly fails is isDevelopmentMode=false and scalingSpec=
Screenshot 2024-11-19 at 3 35 51 PM
  • The other 3 cases correctly pass still
Screenshot 2024-11-19 at 3 37 42 PM - Note isDevelopment=true and scalingSpec=null is fine since users can update the scaling spec later

@vandyliu vandyliu requested a review from a team as a code owner November 19, 2024 23:38
@vandyliu vandyliu merged commit 36f4aaf into main Nov 20, 2024
9 checks passed
@vandyliu vandyliu deleted the allow-dynamic-development-mode branch November 20, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants