diff --git a/client/environment_discovery.go b/client/environment_discovery.go index 6f823af6..65f8df16 100644 --- a/client/environment_discovery.go +++ b/client/environment_discovery.go @@ -19,6 +19,7 @@ type EnvironmentDiscoveryPutPayload struct { BitbucketClientKey string `json:"bitbucketClientKey,omitempty"` IsAzureDevops bool `json:"isAzureDevOps"` Retry TemplateRetry `json:"retry"` + RootPath string `json:"rootPath"` } type EnvironmentDiscoveryPayload struct { @@ -41,6 +42,7 @@ type EnvironmentDiscoveryPayload struct { BitbucketClientKey string `json:"bitbucketClientKey"` IsAzureDevops bool `json:"isAzureDevOps"` Retry TemplateRetry `json:"retry" tfschema:"-"` + RootPath string `json:"rootPath"` } func (client *ApiClient) PutEnvironmentDiscovery(projectId string, payload *EnvironmentDiscoveryPutPayload) (*EnvironmentDiscoveryPayload, error) { diff --git a/env0/resource_environment_discovery_configuration.go b/env0/resource_environment_discovery_configuration.go index 150368b6..0ea91e49 100644 --- a/env0/resource_environment_discovery_configuration.go +++ b/env0/resource_environment_discovery_configuration.go @@ -160,6 +160,11 @@ func resourceEnvironmentDiscoveryConfiguration() *schema.Resource { Description: "a token id to be used with 'gitlab' or 'azure_devops'", Optional: true, }, + "root_path": { + Type: schema.TypeString, + Description: "start files Glob matching from this folder only", + Optional: true, + }, }, } } diff --git a/env0/resource_environment_discovery_configuration_test.go b/env0/resource_environment_discovery_configuration_test.go index f805dfd1..b5f9e087 100644 --- a/env0/resource_environment_discovery_configuration_test.go +++ b/env0/resource_environment_discovery_configuration_test.go @@ -29,6 +29,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { WorkspaceNaming: "default", OpentofuVersion: "1.6.2", GithubInstallationId: 12345, + RootPath: "/path", } getPayload := client.EnvironmentDiscoveryPayload{ @@ -40,6 +41,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { WorkspaceNaming: putPayload.WorkspaceNaming, OpentofuVersion: putPayload.OpentofuVersion, GithubInstallationId: putPayload.GithubInstallationId, + RootPath: putPayload.RootPath, } updatePutPayload := client.EnvironmentDiscoveryPutPayload{ @@ -52,6 +54,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { TerragruntVersion: "0.63.0", GithubInstallationId: 3213, TerragruntTfBinary: "opentofu", + RootPath: "/path2", } updateGetPayload := client.EnvironmentDiscoveryPayload{ @@ -65,6 +68,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { TerragruntVersion: updatePutPayload.TerragruntVersion, GithubInstallationId: updatePutPayload.GithubInstallationId, TerragruntTfBinary: "opentofu", + RootPath: updatePutPayload.RootPath, } testCase := resource.TestCase{ @@ -76,6 +80,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { "repository": putPayload.Repository, "opentofu_version": putPayload.OpentofuVersion, "github_installation_id": putPayload.GithubInstallationId, + "root_path": putPayload.RootPath, }), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(accessor, "project_id", projectId), @@ -86,6 +91,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { resource.TestCheckResourceAttr(accessor, "workspace_naming", putPayload.WorkspaceNaming), resource.TestCheckResourceAttr(accessor, "opentofu_version", putPayload.OpentofuVersion), resource.TestCheckResourceAttr(accessor, "github_installation_id", strconv.Itoa(putPayload.GithubInstallationId)), + resource.TestCheckResourceAttr(accessor, "root_path", putPayload.RootPath), ), }, { @@ -97,6 +103,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { "github_installation_id": updatePutPayload.GithubInstallationId, "type": updatePutPayload.Type, "terragrunt_version": updatePutPayload.TerragruntVersion, + "root_path": updatePutPayload.RootPath, }), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(accessor, "project_id", projectId), @@ -108,6 +115,7 @@ func TestUnitEnvironmentDiscoveryConfigurationResource(t *testing.T) { resource.TestCheckResourceAttr(accessor, "opentofu_version", updatePutPayload.OpentofuVersion), resource.TestCheckResourceAttr(accessor, "github_installation_id", strconv.Itoa(updatePutPayload.GithubInstallationId)), resource.TestCheckResourceAttr(accessor, "terragrunt_version", updatePutPayload.TerragruntVersion), + resource.TestCheckResourceAttr(accessor, "root_path", updatePutPayload.RootPath), ), }, },