Skip to content

Commit

Permalink
add CHANGELOG.md and fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinalirao committed Nov 16, 2022
1 parent 1f947af commit 86b5c96
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

FEATURES:
* r/tfe_organization: Add `allow_force_delete_workspaces` attribute to set whether admins are permitted to delete workspaces with resource under management. ([#661](https://github.com/hashicorp/terraform-provider-tfe/pull/661))
* r/tfe_policy_set: Add OPA support for policy sets. ([#691](https://github.com/hashicorp/terraform-provider-tfe/pull/691))
* d/tfe_policy_set: Add optional `kind` and `overridable` fields for OPA policy sets ([#691](https://github.com/hashicorp/terraform-provider-tfe/pull/691))

## v0.38.0 (October 24, 2022)

Expand Down
1 change: 0 additions & 1 deletion tfe/data_source_policy_set.go
Expand Up @@ -36,7 +36,6 @@ func dataSourceTFEPolicySet() *schema.Resource {
"kind": {
Type: schema.TypeString,
Optional: true,
Default: string(tfe.Sentinel),
},

"overridable": {
Expand Down
2 changes: 2 additions & 0 deletions tfe/data_source_policy_set_test.go
Expand Up @@ -133,6 +133,8 @@ func TestAccTFEPolicySetDataSource_vcs(t *testing.T) {
"data.tfe_policy_set.bar", "description", "Policy Set"),
resource.TestCheckResourceAttr(
"data.tfe_policy_set.bar", "global", "false"),
resource.TestCheckResourceAttr(
"data.tfe_policy_set.bar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"data.tfe_policy_set.bar", "organization", org.Name),
resource.TestCheckResourceAttr(
Expand Down
6 changes: 5 additions & 1 deletion tfe/resource_tfe_policy_set.go
Expand Up @@ -217,14 +217,18 @@ func resourceTFEPolicySetRead(d *schema.ResourceData, meta interface{}) error {
// Update the config.
d.Set("name", policySet.Name)
d.Set("description", policySet.Description)
d.Set("kind", policySet.Kind)
d.Set("global", policySet.Global)
d.Set("policies_path", policySet.PoliciesPath)

if policySet.Organization != nil {
d.Set("organization", policySet.Organization.Name)
}

// Note: Old API endpoints return an empty string, so use the default in the schema
if policySet.Kind != "" {
d.Set("kind", policySet.Kind)
}

if policySet.Overridable != nil {
d.Set("overridable", policySet.Overridable)
}
Expand Down
19 changes: 16 additions & 3 deletions tfe/resource_tfe_policy_set_test.go
Expand Up @@ -125,6 +125,8 @@ func TestAccTFEPolicySet_update(t *testing.T) {
"tfe_policy_set.foobar", "name", "terraform-populated"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "global", "false"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "policy_ids.#", "1"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -227,6 +229,8 @@ func TestAccTFEPolicySet_updatePopulated(t *testing.T) {
"tfe_policy_set.foobar", "name", "terraform-populated-updated"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "global", "false"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "policy_ids.#", "1"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -278,6 +282,8 @@ func TestAccTFEPolicySet_updateToGlobal(t *testing.T) {
"tfe_policy_set.foobar", "name", "terraform-global"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "global", "true"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "policy_ids.#", "1"),
),
Expand Down Expand Up @@ -376,6 +382,8 @@ func TestAccTFEPolicySet_vcs(t *testing.T) {
"tfe_policy_set.foobar", "description", "Policy Set"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "global", "false"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "vcs_repo.0.identifier", GITHUB_POLICY_SET_IDENTIFIER),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -431,6 +439,8 @@ func TestAccTFEPolicySet_updateVCSBranch(t *testing.T) {
"tfe_policy_set.foobar", "description", "Policy Set"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "global", "false"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "vcs_repo.0.identifier", GITHUB_POLICY_SET_IDENTIFIER),
resource.TestCheckResourceAttr(
Expand All @@ -453,6 +463,8 @@ func TestAccTFEPolicySet_updateVCSBranch(t *testing.T) {
"tfe_policy_set.foobar", "description", "Policy Set"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "global", "false"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "kind", "sentinel"),
resource.TestCheckResourceAttr(
"tfe_policy_set.foobar", "vcs_repo.0.identifier", GITHUB_POLICY_SET_IDENTIFIER),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -663,9 +675,10 @@ func TestAccTFEPolicySetImport(t *testing.T) {
},

{
ResourceName: "tfe_policy_set.foobar",
ImportState: true,
ImportStateVerify: true,
ResourceName: "tfe_policy_set.foobar",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"kind", "overridable"},
},
},
})
Expand Down

0 comments on commit 86b5c96

Please sign in to comment.