env0 / terraform-provider-env0

Terraform Provider for env0

Home Page:https://env0.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resource "env0_environment_scheduling" does not pass destroy_cron=null on updates

away168 opened this issue · comments

Describe the bug
When using env0_environment_scheduling resource with a
destroycron=null on a subsequent update to the resource we get this error:

Error: could not create or update environment scheduling: 400 Bad Request: /body/destroy must have required property 'cron', /body/destroy must be null, /body/destroy must match a schema in anyOf

How To Reproduce

  1. tofu apply env0_environment_scheduling on an existing environment.
terraform {
  required_providers {
    env0 = {
      source = "env0/env0"
      version = "~> 1.18.5"
    }
  }
}

locals {
    environment_id = "63a4a4e1-501f-4617-8b41-a46a7238c73c"
}

resource "env0_environment_scheduling" "environment_scheduling" {
  environment_id = local.environment_id
  deploy_cron    = "45 21 * * 0,2,7"
  destroy_cron   = null
}
  1. modify the env0_environment_scheduling deploy_cron to something else.
resource "env0_environment_scheduling" "environment_scheduling" {
  environment_id = local.environment_id
  deploy_cron    = "45 21 * * *"
  destroy_cron   = null
}
  1. Run tofu apply again ^
  2. Get error from backend.

Expected behavior
Resource should get updated without errors.

Provider Version
1.18.5

Screenshots
CleanShot 2024-04-30 at 14 32 24

Additional context
n/a