From 91ba982dbea412050f1a97c577fbf800095cce7a 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 4c9a46eec1..37266ffb6e 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/v85/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 d3fc0802959aa828089ef9932b0363c2eab1b14c 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 37266ffb6e..710ab0490d 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("")