From f11b65570f94466eaef6aa4cf225ba5759624fa4 Mon Sep 17 00:00:00 2001 From: texasich <101962694+texasich@users.noreply.github.com> Date: Wed, 8 Apr 2026 23:32:01 -0500 Subject: [PATCH 1/2] 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 --- github/resource_github_actions_environment_variable.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/github/resource_github_actions_environment_variable.go b/github/resource_github_actions_environment_variable.go index bed56abc2e..2588c8ace9 100644 --- a/github/resource_github_actions_environment_variable.go +++ b/github/resource_github_actions_environment_variable.go @@ -3,11 +3,12 @@ package github import ( "context" "errors" - "log" + "fmt" "net/http" "net/url" "github.com/google/go-github/v84/github" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -140,7 +141,9 @@ func resourceGithubActionsEnvironmentVariableRead(ctx context.Context, d *schema var ghErr *github.ErrorResponse if errors.As(err, &ghErr) { if ghErr.Response.StatusCode == http.StatusNotFound { - log.Printf("[INFO] Removing actions variable %s from state because it no longer exists in GitHub", d.Id()) + tflog.Info(ctx, fmt.Sprintf("Removing actions variable %s from state because it no longer exists in GitHub", d.Id()), map[string]any{ + "variable_id": d.Id(), + }) d.SetId("") return nil } From 7a882e5f01e2960607f7fe8edbc39f55475b34ce Mon Sep 17 00:00:00 2001 From: texasich <101962694+texasich@users.noreply.github.com> Date: Thu, 9 Apr 2026 04:28:45 -0500 Subject: [PATCH 2/2] fix: remove fmt.Sprintf from tflog call, use static message Address review feedback: use static log message string instead of fmt.Sprintf inside tflog.Info. Remove now-unused "fmt" import. --- github/resource_github_actions_environment_variable.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github/resource_github_actions_environment_variable.go b/github/resource_github_actions_environment_variable.go index 2588c8ace9..08b948c953 100644 --- a/github/resource_github_actions_environment_variable.go +++ b/github/resource_github_actions_environment_variable.go @@ -3,7 +3,6 @@ package github import ( "context" "errors" - "fmt" "net/http" "net/url" @@ -141,7 +140,7 @@ func resourceGithubActionsEnvironmentVariableRead(ctx context.Context, d *schema var ghErr *github.ErrorResponse if errors.As(err, &ghErr) { if ghErr.Response.StatusCode == http.StatusNotFound { - tflog.Info(ctx, fmt.Sprintf("Removing actions variable %s from state because it no longer exists in GitHub", d.Id()), map[string]any{ + tflog.Info(ctx, "Removing actions variable from state because it no longer exists in GitHub", map[string]any{ "variable_id": d.Id(), }) d.SetId("")