Skip to content
Open
Changes from all commits
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
6 changes: 4 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,11 @@ package github
import (
"context"
"errors"
"log"
"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 +140,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, "Removing actions variable from state because it no longer exists in GitHub", map[string]any{
"variable_id": d.Id(),
})
d.SetId("")
return nil
}
Expand Down