Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions github/resource_github_actions_environment_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use fmt.Sprintf inside tflog calls

"variable_id": d.Id(),
})
d.SetId("")
return nil
}
Expand Down