Skip to content

Commit

Permalink
Add missing example change
Browse files Browse the repository at this point in the history
  • Loading branch information
simonxmh committed Nov 25, 2024
1 parent c0878ba commit d7edaef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/projects/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"log"

tfe "github.com/hashicorp/go-tfe"

"github.com/hashicorp/jsonapi"
)

func main() {
Expand All @@ -25,7 +27,7 @@ func main() {
ctx := context.Background()

// Create a new project
p, err := client.Projects.Create(ctx, "org-name", tfe.ProjectCreateOptions{
p, err := client.Projects.Create(ctx, "org-test", tfe.ProjectCreateOptions{
Name: "my-app-tst",
})
if err != nil {
Expand All @@ -34,15 +36,15 @@ func main() {

// Update the project auto destroy activity duration
p, err = client.Projects.Update(ctx, p.ID, tfe.ProjectUpdateOptions{
AutoDestroyActivityDuration: tfe.String("3d"),
AutoDestroyActivityDuration: jsonapi.NewNullableAttrWithValue("3d"),
})
if err != nil {
log.Fatal(err)
}

// Disable auto destroy
p, err = client.Projects.Update(ctx, p.ID, tfe.ProjectUpdateOptions{
AutoDestroyActivityDuration: tfe.String(""),
AutoDestroyActivityDuration: jsonapi.NewNullNullableAttr[string](),
})
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit d7edaef

Please sign in to comment.