From 8c78b07bc957861770b925e7247f87f57c663935 Mon Sep 17 00:00:00 2001 From: ChaimP Date: Mon, 26 Aug 2024 12:35:32 +0300 Subject: [PATCH 1/2] move env test - use never deployed env --- tests/integration/012_environment/main.tf | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/integration/012_environment/main.tf b/tests/integration/012_environment/main.tf index 10ae4797..7d93a7cd 100644 --- a/tests/integration/012_environment/main.tf +++ b/tests/integration/012_environment/main.tf @@ -40,7 +40,7 @@ resource "env0_template_project_assignment" "assignment2" { } resource "env0_environment" "auto_glob_envrironment" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] name = "environment-auto-glob-${random_string.random.result}" project_id = env0_project.test_project.id template_id = env0_template.template.id @@ -52,10 +52,10 @@ resource "env0_environment" "auto_glob_envrironment" { } resource "env0_environment" "example" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] force_destroy = true name = "environment-${random_string.random.result}" - project_id = var.second_run ? env0_project.test_project2.id : env0_project.test_project.id + project_id = env0_project.test_project.id template_id = env0_template.template.id configuration { name = "environment configuration variable" @@ -67,6 +67,15 @@ resource "env0_environment" "example" { drift_detection_cron = var.second_run ? "*/5 * * * *" : "*/10 * * * *" } +resource "env0_environment" "move_environment" { + depends_on = [env0_template_project_assignment.assignment] + force_destroy = true + name = "environment-move-${random_string.random.result}" + project_id = var.second_run ? env0_project.test_project2.id : env0_project.test_project.id + template_id = env0_template.template.id + prevent_auto_deploy = true +} + resource "env0_custom_role" "custom_role1" { name = "custom-role-${random_string.random.result}" permissions = [ @@ -126,7 +135,7 @@ resource "env0_template_project_assignment" "terragrunt_assignment" { } resource "env0_environment" "terragrunt_environment" { - depends_on = [env0_template_project_assignment.terragrunt_assignment] + depends_on = [env0_template_project_assignment.terragrunt_assignment] force_destroy = true name = "environment-${random_string.random.result}" project_id = env0_project.test_project.id @@ -175,7 +184,7 @@ resource "env0_environment" "environment-without-template" { } resource "env0_environment" "inactive" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] force_destroy = true name = "environment-${random_string.random.result}-inactive" project_id = env0_project.test_project.id @@ -240,7 +249,10 @@ resource "env0_variable_set" "variable_set2" { } resource "env0_environment" "workflow-environment" { - depends_on = [env0_template_project_assignment.assignment_workflow, env0_template_project_assignment.assignment_sub_environment_null_template] + depends_on = [ + env0_template_project_assignment.assignment_workflow, + env0_template_project_assignment.assignment_sub_environment_null_template + ] force_destroy = true name = "environment-workflow-${random_string.random.result}" project_id = env0_project.test_project.id @@ -270,7 +282,7 @@ resource "env0_environment" "workflow-environment" { } resource "env0_environment" "mark_as_archived" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] name = "environment-mark-as-archived-${random_string.random.result}" project_id = env0_project.test_project.id template_id = env0_template.template.id From 7df2e72a57e43769afc37ceba4d20f7efb1afae5 Mon Sep 17 00:00:00 2001 From: ChaimP Date: Mon, 26 Aug 2024 12:43:17 +0300 Subject: [PATCH 2/2] fmt --- tests/integration/012_environment/main.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/012_environment/main.tf b/tests/integration/012_environment/main.tf index 7d93a7cd..a1dc4426 100644 --- a/tests/integration/012_environment/main.tf +++ b/tests/integration/012_environment/main.tf @@ -40,7 +40,7 @@ resource "env0_template_project_assignment" "assignment2" { } resource "env0_environment" "auto_glob_envrironment" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] name = "environment-auto-glob-${random_string.random.result}" project_id = env0_project.test_project.id template_id = env0_template.template.id @@ -52,7 +52,7 @@ resource "env0_environment" "auto_glob_envrironment" { } resource "env0_environment" "example" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] force_destroy = true name = "environment-${random_string.random.result}" project_id = env0_project.test_project.id @@ -68,7 +68,7 @@ resource "env0_environment" "example" { } resource "env0_environment" "move_environment" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] force_destroy = true name = "environment-move-${random_string.random.result}" project_id = var.second_run ? env0_project.test_project2.id : env0_project.test_project.id @@ -135,7 +135,7 @@ resource "env0_template_project_assignment" "terragrunt_assignment" { } resource "env0_environment" "terragrunt_environment" { - depends_on = [env0_template_project_assignment.terragrunt_assignment] + depends_on = [env0_template_project_assignment.terragrunt_assignment] force_destroy = true name = "environment-${random_string.random.result}" project_id = env0_project.test_project.id @@ -184,7 +184,7 @@ resource "env0_environment" "environment-without-template" { } resource "env0_environment" "inactive" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] force_destroy = true name = "environment-${random_string.random.result}-inactive" project_id = env0_project.test_project.id @@ -282,7 +282,7 @@ resource "env0_environment" "workflow-environment" { } resource "env0_environment" "mark_as_archived" { - depends_on = [env0_template_project_assignment.assignment] + depends_on = [env0_template_project_assignment.assignment] name = "environment-mark-as-archived-${random_string.random.result}" project_id = env0_project.test_project.id template_id = env0_template.template.id