env0 / terraform-provider-env0

Terraform Provider for env0

Home Page:https://env0.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Environment without_template_settings set `terraform_version` for non-terraform environments

eranelbaz opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.
Creating cloudformation type environment without template set terraform_version automatically to 0.15.1 which shouldn't be there

To Reproduce
main.tf

resource "env0_environment" "environment-without-template" {
  force_destroy                    = true
  name                             = "environment-without-template"
  project_id                       = "3ba1a31e-1c83-4c24-9a73-92eb0fead311"
  approve_plan_automatically       = true
  auto_deploy_on_path_changes_only = false

  without_template_settings {
    type                                    = "cloudformation"
    revision                                = "master"
    repository                              = "github.com/eranelbaz/templates.git"
    path                                    = "misc/null-resource"
    retries_on_deploy                       = 3
    retries_on_destroy                      = 1
  }
}

> tofu plan
.
.
.
OpenTofu will perform the following actions:

  # env0_environment.environment-without-template will be created
  + resource "env0_environment" "environment-without-template" {
      + approve_plan_automatically       = true
      + auto_deploy_on_path_changes_only = false
      + deployment_id                    = (known after apply)
      + force_destroy                    = true
      + id                               = (known after apply)
      + is_inactive                      = false
      + is_remote_apply_enabled          = false
      + name                             = "environment-without-template"
      + output                           = (known after apply)
      + project_id                       = "3ba1a31e-1c83-4c24-9a73-92eb0fead311"
      + removal_strategy                 = "destroy"
      + revision                         = (known after apply)
      + workspace                        = (known after apply)

      + without_template_settings {
          + id                    = (known after apply)
          + is_azure_devops       = false
          + is_bitbucket_server   = false
          + is_github_enterprise  = false
          + is_gitlab_enterprise  = false
          + is_helm_repository    = false
          + is_terragrunt_run_all = false
          + path                  = "misc/null-resource"
          + repository            = "github.com/eranelbaz/templates.git"
          + retries_on_deploy     = 3
          + retries_on_destroy    = 1
          + revision              = "master"
          + terraform_version     = "0.15.1"
          + type                  = "cloudformation"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Expected behavior
env0 provider shouldn't add terraform_version for non-terraform environment types

Provider Version
E.g.: 1.18.0

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Seems like similar issue to Cloudformation Template - Forcing refresh of a TerraformVersion field · Issue #818 · env0/terraform-provider-env0