Skip to content

Commit

Permalink
Skip Beta tests in CI and add CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinalirao committed Nov 15, 2022
1 parent a18da5d commit 966d2c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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: Add OPA support for policies ([#690](https://github.com/hashicorp/terraform-provider-tfe/pull/690))

## v0.38.0 (October 24, 2022)

Expand Down
6 changes: 4 additions & 2 deletions tfe/resource_tfe_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tfe

import (
"context"
"errors"
"fmt"
"log"
"strings"
Expand Down Expand Up @@ -167,7 +168,7 @@ func resourceTFEPolicyRead(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] Read policy: %s", d.Id())
policy, err := tfeClient.Policies.Read(ctx, d.Id())
if err != nil {
if err == tfe.ErrResourceNotFound {
if errors.Is(err, tfe.ErrResourceNotFound) {
log.Printf("[DEBUG] Policy %s does no longer exist", d.Id())
d.SetId("")
return nil
Expand Down Expand Up @@ -196,6 +197,7 @@ func resourceTFEPolicyRead(d *schema.ResourceData, meta interface{}) error {
func resourceTFEPolicyUpdate(d *schema.ResourceData, meta interface{}) error {
tfeClient := meta.(*tfe.Client)

// nolint:nestif
if d.HasChange("description") || d.HasChange("enforce_mode") {
// Create a new options struct.
options := tfe.PolicyUpdateOptions{}
Expand Down Expand Up @@ -246,7 +248,7 @@ func resourceTFEPolicyDelete(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] Delete policy: %s", d.Id())
err := tfeClient.Policies.Delete(ctx, d.Id())
if err != nil {
if err == tfe.ErrResourceNotFound {
if errors.Is(err, tfe.ErrResourceNotFound) {
return nil
}
return fmt.Errorf("Error deleting policy %s: %w", d.Id(), err)
Expand Down
6 changes: 6 additions & 0 deletions tfe/resource_tfe_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestAccTFEPolicy_basic(t *testing.T) {
skipUnlessBeta(t)
tfeClient, err := getClientUsingEnv()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -48,6 +49,7 @@ func TestAccTFEPolicy_basic(t *testing.T) {
}

func TestAccTFEPolicyOPA_basic(t *testing.T) {
skipUnlessBeta(t)
tfeClient, err := getClientUsingEnv()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -88,6 +90,7 @@ func TestAccTFEPolicyOPA_basic(t *testing.T) {
}

func TestAccTFEPolicy_update(t *testing.T) {
skipUnlessBeta(t)
tfeClient, err := getClientUsingEnv()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -143,6 +146,7 @@ func TestAccTFEPolicy_update(t *testing.T) {
}

func TestAccTFEPolicyOPA_update(t *testing.T) {
skipUnlessBeta(t)
tfeClient, err := getClientUsingEnv()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -202,6 +206,7 @@ func TestAccTFEPolicyOPA_update(t *testing.T) {
}

func TestAccTFEPolicy_import(t *testing.T) {
skipUnlessBeta(t)
tfeClient, err := getClientUsingEnv()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -245,6 +250,7 @@ func testAccCheckTFEPolicyExists(

p, err := tfeClient.Policies.Read(ctx, rs.Primary.ID)
if err != nil {
// nolint: wrapcheck
return err
}

Expand Down

0 comments on commit 966d2c2

Please sign in to comment.