Skip to content

github_repository does not have attribute http_clone_url error #77

Closed

Description

@lapots

I want to create repository and initialize git locally after successful creation. Accoding to the doc providers/github there is the attribute http_clone_url. So my .tf file looks like this.

variable "github_token" {}

provider "github" {
    token = "${var.github_token}"
    organization = ""
}

resource "github_repository" "sandbox" {
    name = "sandbox-application"
    description = "sandbox application for testing functionality"
    
    auto_init = true
}

# move to github_repository provisioner if possible
resource "null_resource" "init_local" {
    depends_on = ["github_repository.sandbox"]
    
    provisioner "local-exec" {
        command = "git init && git remote add origin ${github_repository.sandbox.http_clone_url}"
    }
}

But when I run apply I get the error

* null_resource.init_local: 1 error(s) occurred:

* Resource 'github_repository.sandbox' does not have attribute 'http_clone_url' for variable 'github_repository.sandbox.
http_clone_url'

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

So it seems this attribute does not exist? Or I am doing something wrong?

Activity

  1. paultyng commented on Mar 8, 2018

    @paultyng
    Contributor

    I can't see anything wrong offhand, my only thought is its possibly an older version? Can you put the debug output in the issue (see the issue template)?

  2. added
    Type: Bug
    on Mar 8, 2018
  3. lapots commented on Mar 12, 2018

    @lapots
    Author

    Hi!
    Sorry for late response
    Here is the link to log gist debug log

  4. paultyng commented on Mar 13, 2018

    @paultyng
    Contributor

    So it looks like in some cases the blank organization name is a problem? (see this log entry)

    I would try explicitly setting your organization to your name.

  5. paultyng commented on Mar 13, 2018

    @paultyng
    Contributor

    Its actually marked as required in the code so looks like just a typo on the website.

  6. added
    Type: Documentation
    and removed on Mar 13, 2018
  7. lapots commented on Mar 13, 2018

    @lapots
    Author

    Well possible it is due to no organization. Hm.

    As I don't have an organization I set it as empty and it worked. It even created the repository with the initial commit just fine.

  8. paultyng commented on Mar 13, 2018

    @paultyng
    Contributor

    Can you try just lapots as the org?

  9. lapots commented on Mar 13, 2018

    @lapots
    Author

    I tried lapots, lapots-github, github-lapots and others but it returns 404 on

    * github_repository.sandbox: POST https://api.github.com/orgs/lapots/repos: 404 Not Found []
    

    because the user itself doesn't have organizations

    GET https://api.github.com/users/lapots/orgs
    

    returns empty list

  10. paultyng commented on Mar 13, 2018

    @paultyng
    Contributor

    😢 ok I will dig in a little. Per those other issues it does seem like we don't support personal repos, I have only used this against an org.

  11. lapots commented on Mar 13, 2018

    @lapots
    Author

    I see 😭 Then I'll just create url in .tf manually

  12. lapots commented on Mar 15, 2018

    @lapots
    Author
  13. radeksimko commented on Aug 15, 2018

    @radeksimko
    Contributor

    Thank you all for taking the time to debug this. Based on all the information provided here I'm going to close this in favour of #45 as I believe that issue is slightly more accurate in reflecting where the problem is and how it needs to be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugType: Documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions