diff --git a/github/data_source_github_ref.go b/github/data_source_github_ref.go index 9ab79ddd1d..e5c87076f0 100644 --- a/github/data_source_github_ref.go +++ b/github/data_source_github_ref.go @@ -14,12 +14,12 @@ func dataSourceGithubRef() *schema.Resource { Read: dataSourceGithubRefRead, Schema: map[string]*schema.Schema{ - "repository": { + "ref": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "branch": { + "repository": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -28,10 +28,6 @@ func dataSourceGithubRef() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ref": { - Type: schema.TypeString, - Computed: true, - }, "sha": { Type: schema.TypeString, Computed: true, @@ -60,7 +56,6 @@ func dataSourceGithubRefRead(d *schema.ResourceData, meta interface{}) error { d.SetId(buildTwoPartID(repoName, ref)) d.Set("etag", resp.Header.Get("ETag")) - d.Set("ref", *refData.Ref) d.Set("sha", *refData.Object.SHA) return nil diff --git a/github/data_source_github_ref_test.go b/github/data_source_github_ref_test.go index 0928e05866..e36343f98b 100644 --- a/github/data_source_github_ref_test.go +++ b/github/data_source_github_ref_test.go @@ -13,8 +13,7 @@ func TestAccGithubRefDataSource(t *testing.T) { randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - t.Run("queries an existing ref without error", func(t *testing.T) { - + t.Run("queries an existing branch ref without error", func(t *testing.T) { config := fmt.Sprintf(` resource "github_repository" "test" { name = "tf-acc-test-%[1]s" @@ -23,7 +22,7 @@ func TestAccGithubRefDataSource(t *testing.T) { data "github_ref" "test" { repository = github_repository.test.id - ref = "/heads/main" + ref = "heads/main" } `, randomID) diff --git a/website/docs/d/ref.html.markdown b/website/docs/d/ref.html.markdown index b8dcde89b3..2e4a757493 100644 --- a/website/docs/d/ref.html.markdown +++ b/website/docs/d/ref.html.markdown @@ -5,7 +5,7 @@ description: |- Get information about a repository ref. --- -# github\ref +# github_ref Use this data source to retrieve information about a repository ref.