Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber committed Mar 14, 2024
1 parent 42fd769 commit 7c28959
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import env0_environment_discovery_configuration.by_project_id 29b8037a-f877-48f5-a60b-3152ae1a1405
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
data "env0_project" "project" {
name = "existing-project"
}

resource "env0_project" "new_project" {
name = "new-project"
}

resource "env0_environment_discovery_configuration" "example" {
project_id = data.env0_project.project.id
glob_pattern = "**"
repository = "https://github.com/env0/templates"
opentofu_version = "1.6.7"
github_installation_id = 12345
}

resource "env0_environment_discovery_configuration" "terragrunt_example" {
project_id = env0_project.new_project.id
glob_pattern = "**"
repository = "https://github.com/env0/blueprints"
type = "terragrunt"
terraform_version = "1.7.1"
terragrunt_version = "0.67.4"
terragrunt_tf_binary = "terraform"
github_installation_id = 12345
}
13 changes: 13 additions & 0 deletions tests/integration/032_environment_discovery_configuration/conf.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
backend "local" {
}
required_providers {
env0 = {
source = "terraform-registry.env0.com/env0/env0"
}
}
}

provider "env0" {}

variable "second_run" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
30 changes: 30 additions & 0 deletions tests/integration/032_environment_discovery_configuration/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
provider "random" {}

resource "random_string" "random" {
length = 8
special = false
min_lower = 8
}

resource "env0_project" "project" {
name = "project-${random_string.random.result}"
}

data "env0_template" "github_template" {
name = "Github Integrated Template"
}

resource "env0_template_project_assignment" "assignment" {
template_id = data.env0_template.github_template.id
project_id = env0_project.project.id
}

resource "env0_environment_discovery_configuration" "example" {
project_id = data.env0_project.project.id
glob_pattern = var.second_run ? "**" : "**/**"
opentofu_version = "1.6.2"
repository = data.env0_template.github_template.repository
github_installation_id = data.env0_template.github_template.github_installation_id

depends_on = [env0_template_project_assignment.assignment]
}

0 comments on commit 7c28959

Please sign in to comment.