diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 9383a8678d..f5e20c4cf7 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -93,6 +93,10 @@ func resourceGithubRepository() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "html_url": { + Type: schema.TypeString, + Computed: true, + }, "ssh_clone_url": { Type: schema.TypeString, Computed: true, @@ -198,6 +202,7 @@ func resourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) erro d.Set("has_downloads", repo.HasDownloads) d.Set("full_name", repo.FullName) d.Set("default_branch", repo.DefaultBranch) + d.Set("html_url", repo.HTMLURL) d.Set("ssh_clone_url", repo.SSHURL) d.Set("svn_url", repo.SVNURL) d.Set("git_clone_url", repo.GitURL) diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index 0774bce60a..40ea1a90ec 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -408,6 +408,9 @@ func testAccCheckGithubRepositoryAttributes(repo *github.Repository, want *testA if !strings.HasPrefix(*repo.CloneURL, "https://") { return fmt.Errorf("got Clone URL %q; want to start with 'https://'", *repo.CloneURL) } + if !strings.HasSuffix(*repo.HTMLURL, "/"+want.Name) { + return fmt.Errorf("got HTML URL %q; want to end with '%s'", *repo.HTMLURL, want.Name) + } if !strings.HasSuffix(*repo.SSHURL, "/"+want.Name+".git") { return fmt.Errorf("got SSH URL %q; want to end with '/%s.git'", *repo.SSHURL, want.Name) } diff --git a/website/docs/r/repository.html.markdown b/website/docs/r/repository.html.markdown index 6494ae0555..98100e591c 100644 --- a/website/docs/r/repository.html.markdown +++ b/website/docs/r/repository.html.markdown @@ -74,6 +74,8 @@ The following additional attributes are exported: * `full_name` - A string of the form "orgname/reponame". +* `html_url` - URL to the repository on the web. + * `ssh_clone_url` - URL that can be provided to `git clone` to clone the repository via SSH.