Skip to content

Commit 91ba982

Browse files
committed
refactor: migrate resource_github_actions_environment_variable to tflog
Replace Go standard `log` package with HashiCorp structured `tflog` for consistent logging across the provider. Changes: - Replace `log` import with `fmt` and add `tflog` import - Convert `log.Printf` to `tflog.Info` with structured fields Part of #3070
1 parent 18178b1 commit 91ba982

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

github/resource_github_actions_environment_variable.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package github
33
import (
44
"context"
55
"errors"
6-
"log"
6+
"fmt"
77
"net/http"
88
"net/url"
99

1010
"github.com/google/go-github/v85/github"
11+
"github.com/hashicorp/terraform-plugin-log/tflog"
1112
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1213
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1314
)
@@ -140,7 +141,9 @@ func resourceGithubActionsEnvironmentVariableRead(ctx context.Context, d *schema
140141
var ghErr *github.ErrorResponse
141142
if errors.As(err, &ghErr) {
142143
if ghErr.Response.StatusCode == http.StatusNotFound {
143-
log.Printf("[INFO] Removing actions variable %s from state because it no longer exists in GitHub", d.Id())
144+
tflog.Info(ctx, fmt.Sprintf("Removing actions variable %s from state because it no longer exists in GitHub", d.Id()), map[string]any{
145+
"variable_id": d.Id(),
146+
})
144147
d.SetId("")
145148
return nil
146149
}

0 commit comments

Comments
 (0)