88 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
99)
1010
11- func resourceGithubRepositoryAutolinkReferenceV0 () * schema.Resource {
11+ func resourceGithubRepositoryAutolinkReferenceV1 () * schema.Resource {
1212 return & schema.Resource {
1313 Schema : map [string ]* schema.Schema {
1414 "repository" : {
@@ -40,8 +40,8 @@ func resourceGithubRepositoryAutolinkReferenceV0() *schema.Resource {
4040 }
4141}
4242
43- func resourceGithubRepositoryAutolinkReferenceStateUpgradeV0 (ctx context.Context , rawState map [string ]any , m any ) (map [string ]any , error ) {
44- tflog .Debug (ctx , "GitHub Repository Autolink Reference state before v0 migration" , rawState )
43+ func resourceGithubRepositoryAutolinkReferenceStateUpgradeV1 (ctx context.Context , rawState map [string ]any , m any ) (map [string ]any , error ) {
44+ tflog .Debug (ctx , "GitHub Repository Autolink Reference state before v1 migration" , rawState )
4545
4646 meta , _ := m .(* Owner )
4747 client := meta .v3client
@@ -54,17 +54,17 @@ func resourceGithubRepositoryAutolinkReferenceStateUpgradeV0(ctx context.Context
5454 }
5555 }
5656 if repoName == "" {
57- return nil , fmt .Errorf ("state upgrade v0 : repository is not a string or not set" )
57+ return nil , fmt .Errorf ("state upgrade v1 : repository is not a string or not set" )
5858 }
5959
6060 repo , _ , err := client .Repositories .Get (ctx , owner , repoName )
6161 if err != nil {
62- return nil , fmt .Errorf ("state upgrade v0 : failed to retrieve repository '%s': %w" , repoName , err )
62+ return nil , fmt .Errorf ("state upgrade v1 : failed to retrieve repository '%s/%s ': %w" , owner , repoName , err )
6363 }
6464
6565 rawState ["repository_id" ] = int (repo .GetID ())
6666
67- tflog .Debug (ctx , "GitHub Repository Autolink Reference state after v0 migration" , rawState )
67+ tflog .Debug (ctx , "GitHub Repository Autolink Reference state after v1 migration" , rawState )
6868
6969 return rawState , nil
7070}
0 commit comments