env0 / terraform-provider-env0

Terraform Provider for env0

Home Page:https://env0.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configuration Variable defined in env0_environment resource getting "updated" in plan

away168 opened this issue · comments

Describe the bug
Using env0_environment with configuration block - on a plan - the configuration block is being recreated.

To Reproduce
FWIW: this is a workflow template - creating terraform configuration variables.

resource "env0_environment" "ecs-laster-env0" {
  name       = "ecs-laster-example"
  project_id = "(redacted)"
  #  project_id                       = data.env0_project.ecs-service.id
  template_id                      = data.env0_template.ecs-service.id
  run_plan_on_pull_requests        = false
  deploy_on_push                   = false
  auto_deploy_on_path_changes_only = false
  revision                         = "main"
  force_destroy                    = true
  approve_plan_automatically       = true
  is_inactive                      = false

  configuration {
    is_read_only = true
    is_required  = true
    is_sensitive = false
    name         = "servicename"
    schema_type  = "string"
    type         = "terraform"
    value        = "ecs-laster-env0"
  }
}

Expected behavior
Plan should show no changes after initial deployment.

Provider Version
1.16.0

Screenshots
CleanShot 2023-11-28 at 12 11 30

Additional context
Template type is a Workflow type.

@away168 workflow has many limitations concerning to the terraform provider especially because many of the configurations are coming from a yaml file.

Where are the "sub_environment_configuration" entries?

Notice the following comment:
"the subenvironments for a workflow environment. Template type must be 'workflow'. Must match the configuration as defined in 'env0.workflow.yml'",

I'm wondering where these variables are coming from?
I will need more information.

@TomerHeber we're not using subenvironment configuration variables - just defining configuration for the entire workflow. In the UI, you can define Environment Variables that would be applied to all sub-environments). In this particular case, we're defining a Terraform Variable for all sub-environments.

@away168 makes sense. What are all these configuration changes? where is it coming from?

@TomerHeber the screenshot is a more complete code, I only copied and pasted one configuration variable, when the customer in fact has 8 or 9 configuration variable in his code.