diff --git a/examples/resources/env0_environment_discovery_configuration/import.sh b/examples/resources/env0_environment_discovery_configuration/import.sh new file mode 100644 index 00000000..818d9833 --- /dev/null +++ b/examples/resources/env0_environment_discovery_configuration/import.sh @@ -0,0 +1 @@ +terraform import env0_environment_discovery_configuration.by_project_id 29b8037a-f877-48f5-a60b-3152ae1a1405 \ No newline at end of file diff --git a/examples/resources/env0_environment_discovery_configuration/resource.tf b/examples/resources/env0_environment_discovery_configuration/resource.tf new file mode 100644 index 00000000..015c1de8 --- /dev/null +++ b/examples/resources/env0_environment_discovery_configuration/resource.tf @@ -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 +} diff --git a/tests/integration/032_environment_discovery_configuration/conf.tf b/tests/integration/032_environment_discovery_configuration/conf.tf new file mode 100644 index 00000000..58dc45e8 --- /dev/null +++ b/tests/integration/032_environment_discovery_configuration/conf.tf @@ -0,0 +1,13 @@ +terraform { + backend "local" { + } + required_providers { + env0 = { + source = "terraform-registry.env0.com/env0/env0" + } + } +} + +provider "env0" {} + +variable "second_run" {} diff --git a/tests/integration/032_environment_discovery_configuration/expected_outputs.json b/tests/integration/032_environment_discovery_configuration/expected_outputs.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/tests/integration/032_environment_discovery_configuration/expected_outputs.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/integration/032_environment_discovery_configuration/main.tf b/tests/integration/032_environment_discovery_configuration/main.tf new file mode 100644 index 00000000..ca067763 --- /dev/null +++ b/tests/integration/032_environment_discovery_configuration/main.tf @@ -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] +}