diff --git a/client/project_policy.go b/client/project_policy.go index 116f499f..5770c976 100644 --- a/client/project_policy.go +++ b/client/project_policy.go @@ -19,6 +19,7 @@ type Policy struct { ForceRemoteBackend bool `json:"forceRemoteBackend"` DriftDetectionCron string `json:"driftDetectionCron"` DriftDetectionEnabled bool `json:"driftDetectionEnabled"` + OutputsAsInputsEnabled bool `json:"outputsAsInputsEnabled"` } type PolicyUpdatePayload struct { @@ -38,6 +39,7 @@ type PolicyUpdatePayload struct { DriftDetectionCron string `json:"driftDetectionCron"` DriftDetectionEnabled bool `json:"driftDetectionEnabled"` VcsPrCommentsEnabledDefault bool `json:"vcsPrCommentsEnabledDefault"` + OutputsAsInputsEnabled bool `json:"outputsAsInputsEnabled"` } // Policy retrieves a policy from the API diff --git a/env0/resource_configuration_variable_test.go b/env0/resource_configuration_variable_test.go index ccd390d6..cd57c385 100644 --- a/env0/resource_configuration_variable_test.go +++ b/env0/resource_configuration_variable_test.go @@ -758,13 +758,6 @@ resource "%s" "test" { createParams := configurationVariableCreateParams createParams.IsReadOnly = true createParams.IsRequired = true - updateParams := createParams - updateParams.Name = newConfigVar.Name - updateParams.Value = "" - updateParams.Description = newConfigVar.Description - updateParams.Format = client.HCL - updateParams.IsReadOnly = *newConfigVar.IsReadOnly - updateParams.IsRequired = *newConfigVar.IsRequired mock.EXPECT().ConfigurationVariableCreate(createParams).Times(1).Return(newConfigVar, nil) gomock.InOrder( diff --git a/env0/resource_project_policy.go b/env0/resource_project_policy.go index b683e22a..a9b38287 100644 --- a/env0/resource_project_policy.go +++ b/env0/resource_project_policy.go @@ -113,7 +113,13 @@ func resourceProjectPolicy() *schema.Resource { }, "vcs_pr_comments_enabled_default": { Type: schema.TypeBool, - Description: "if 'true' all environments created in this project will be created with an 'enabled' running VCS PR plan/apply commands using PR comments", + Description: "if 'true' all environments created in this project will be created with an 'enabled' running VCS PR plan/apply commands using PR comments. Default is 'false'", + Optional: true, + Default: false, + }, + "outputs_as_inputs_enabled": { + Type: schema.TypeBool, + Description: "if 'true' enables 'environment outputs'. Default is 'false'", Optional: true, Default: false, }, diff --git a/env0/resource_project_policy_test.go b/env0/resource_project_policy_test.go index ca5d2e5d..b874a81d 100644 --- a/env0/resource_project_policy_test.go +++ b/env0/resource_project_policy_test.go @@ -31,6 +31,7 @@ func TestUnitProjectPolicyResource(t *testing.T) { DriftDetectionCron: "0 4 * * *", DriftDetectionEnabled: true, VcsPrCommentsEnabledDefault: true, + OutputsAsInputsEnabled: true, } updatedPolicy := client.Policy{ @@ -72,6 +73,7 @@ func TestUnitProjectPolicyResource(t *testing.T) { "force_remote_backend": policy.ForceRemoteBackend, "drift_detection_cron": policy.DriftDetectionCron, "vcs_pr_comments_enabled_default": policy.VcsPrCommentsEnabledDefault, + "outputs_as_inputs_enabled": policy.OutputsAsInputsEnabled, }), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(accessor, "project_id", policy.ProjectId), @@ -89,6 +91,7 @@ func TestUnitProjectPolicyResource(t *testing.T) { resource.TestCheckResourceAttr(accessor, "force_remote_backend", strconv.FormatBool(policy.ForceRemoteBackend)), resource.TestCheckResourceAttr(accessor, "drift_detection_cron", policy.DriftDetectionCron), resource.TestCheckResourceAttr(accessor, "vcs_pr_comments_enabled_default", strconv.FormatBool(policy.VcsPrCommentsEnabledDefault)), + resource.TestCheckResourceAttr(accessor, "outputs_as_inputs_enabled", strconv.FormatBool(policy.OutputsAsInputsEnabled)), ), }, { @@ -116,6 +119,7 @@ func TestUnitProjectPolicyResource(t *testing.T) { resource.TestCheckResourceAttr(accessor, "force_remote_backend", strconv.FormatBool(updatedPolicy.ForceRemoteBackend)), resource.TestCheckResourceAttr(accessor, "drift_detection_cron", updatedPolicy.DriftDetectionCron), resource.TestCheckResourceAttr(accessor, "vcs_pr_comments_enabled_default", strconv.FormatBool(updatedPolicy.VcsPrCommentsEnabledDefault)), + resource.TestCheckResourceAttr(accessor, "outputs_as_inputs_enabled", strconv.FormatBool(updatedPolicy.OutputsAsInputsEnabled)), ), }, }, @@ -139,6 +143,7 @@ func TestUnitProjectPolicyResource(t *testing.T) { DriftDetectionEnabled: true, DriftDetectionCron: policy.DriftDetectionCron, VcsPrCommentsEnabledDefault: policy.VcsPrCommentsEnabledDefault, + OutputsAsInputsEnabled: policy.OutputsAsInputsEnabled, }).Times(1).Return(policy, nil), mock.EXPECT().Policy(gomock.Any()).Times(2).Return(policy, nil), // 1 after create, 1 before update // Update diff --git a/tests/integration/011_policy/main.tf b/tests/integration/011_policy/main.tf index 2c30bc3c..73503a79 100644 --- a/tests/integration/011_policy/main.tf +++ b/tests/integration/011_policy/main.tf @@ -31,6 +31,7 @@ resource "env0_project_policy" "test_policy_2" { disable_destroy_environments = true skip_redundant_deployments = true vcs_pr_comments_enabled_default = true + outputs_as_inputs_enabled = true } resource "env0_project_policy" "test_policy_ttl" {