Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
GiliFaroEnv0 committed Nov 23, 2021
1 parent 775775d commit a091d51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/project_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ resource "env0_project_policy" "example" {

### Optional

- **continuous_deployment_default** (Boolean) Redeploy on every push to the git branch default value
- **disable_destroy_environments** (Boolean) Disallow destroying environment in the project
- **include_cost_estimation** (Boolean) Enable cost estimation for the project
- **number_of_environments** (Number) Max number of environments a single user can have in this project, 0 indicates no limit
- **number_of_environments_total** (Number) Max number of environments in this project, 0 indicates no limit
- **requires_approval_default** (Boolean) Requires approval default value when creating a new environment in the project
- **run_pull_request_plan_default** (Boolean) Run Terraform Plan on Pull Requests for new environments targeting their branch default value
- **skip_apply_when_plan_is_empty** (Boolean) Skip apply when plan has no changes
- **skip_redundant_deployments** (Boolean) Automatically skip queued deployments when a newer deployment is triggered

Expand Down
14 changes: 14 additions & 0 deletions env0/resource_project_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ func resourcePolicy() *schema.Resource {
Description: "updated by",
Computed: true,
},
"run_pull_request_plan_default": {
Type: schema.TypeBool,
Description: "Run Terraform Plan on Pull Requests for new environments targeting their branch default value",
Optional: true,
Default: false,
},
"continuous_deployment_default": {
Type: schema.TypeBool,
Description: "Redeploy on every push to the git branch default value",
Optional: true,
Default: false,
},
},
}
}
Expand All @@ -108,6 +120,8 @@ func setPolicySchema(d *schema.ResourceData, policy client.Policy) {
d.Set("disable_destroy_environments", policy.DisableDestroyEnvironments)
d.Set("skip_redundant_deployments", policy.SkipRedundantDeployments)
d.Set("updated_by", policy.UpdatedBy)
d.Set("run_pull_request_plan_default", policy.RunPullRequestPlanDefault)
d.Set("continuous_deployment_default" , policy.ContinuousDeploymentDefault)
}

func resourcePolicyCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Expand Down
4 changes: 4 additions & 0 deletions env0/resource_project_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func TestUnitPolicyResource(t *testing.T) {
"skip_apply_when_plan_is_empty": policy.SkipApplyWhenPlanIsEmpty,
"disable_destroy_environments": policy.DisableDestroyEnvironments,
"skip_redundant_deployments": policy.SkipRedundantDeployments,
"run_pull_request_plan_default": policy.RunPullRequestPlanDefault,
"continuous_deployment_default": policy.ContinuousDeploymentDefault,
}),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(accessor, "project_id", policy.ProjectId),
Expand All @@ -67,6 +69,8 @@ func TestUnitPolicyResource(t *testing.T) {
resource.TestCheckResourceAttr(accessor, "skip_apply_when_plan_is_empty", strconv.FormatBool(policy.SkipApplyWhenPlanIsEmpty)),
resource.TestCheckResourceAttr(accessor, "disable_destroy_environments", strconv.FormatBool(policy.DisableDestroyEnvironments)),
resource.TestCheckResourceAttr(accessor, "skip_redundant_deployments", strconv.FormatBool(policy.SkipRedundantDeployments)),
resource.TestCheckResourceAttr(accessor, "run_pull_request_plan_default", strconv.FormatBool(policy.RunPullRequestPlanDefault)),
resource.TestCheckResourceAttr(accessor, "continuous_deployment_default", strconv.FormatBool(policy.ContinuousDeploymentDefault)),
),
},
{
Expand Down

0 comments on commit a091d51

Please sign in to comment.