Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github provider #1731

Closed
kaelumania opened this issue Apr 29, 2015 · 12 comments
Closed

github provider #1731

kaelumania opened this issue Apr 29, 2015 · 12 comments

Comments

@kaelumania
Copy link

I think it would be useful to have a github provider/resource in order to generate ssh keys and allow web server to pull code from a github repository.

@mitchellh
Copy link
Contributor

Can you show a hypothetical configuration here?

@ketzacoatl
Copy link
Contributor

how about:

resource "github_sshkey" "deploy" {
    token = "${var.gh_token}"
    username = "${var.gh_user}"
    pubkey = "${var.gh_pubkey}"
}

@ejholmes
Copy link

I was actually pretty surprised to find that there was no github provider in terraform. I think there's a couple of really useful resources that could be exposed:

  • github_repository: Ensures that a repo exists.
  • github_hook: Ensures that a repo hook is setup.
  • github_sshkey: Like above.

Being able to just use terraform to mass update webhooks on repos would be amazing.

@apparentlymart
Copy link
Contributor

This was already discussed a bit in #3544. Maybe we can collect these use-cases over there?

@apparentlymart
Copy link
Contributor

We use Beanstalk for git hosting and built an out-of-tree plugin for it to manage our repositories.

Here's an example from our config, with similar use-cases but adapted to Github's vernacular:

resource "github_repository" "terraform" {
    name = "terraform"

    // Optional. If not specified, creates a personal repository for the authenticated user.
    organization_name = "hashicorp"

    description = "Terraform is a tool for building, changing, and combining infrastructure safely and efficiently."
    homepage_url = "https://terraform.io/"
}

resource "github_repository_webhook" "sns" {
    // (the beanstalk provider doesn't actually have an equivalent for this yet, because
    //  we've not yet got any webhooks. We expect to add this in the next few months, though.)
    repository_name = "${github_repository.terraform.name}"
    repository_owner_name = "${github_repository.terraform.organization_name}"
    type = "amazonsns"
    config = {
        aws_key = "..."
        aws_secret = "..."
        sns_topic = "..."
        sns_region = "us-east-1"
    }
}

resource "github_team" "terraform_contributors" {
    name = "Terraform Contributors"
    description = "Community contributors to Terraform"
}

resource "github_team_member" "terraform_contributors_apparentlymart" {
    organization_name = "hashicorp"
    team_id = "${github_team.terraform_contributors.id}"
    username = "apparentlymart"
}

resource "github_team_repository_permission": "terraform_contributors" {
    organization_name = "hashicorp"
    team_id = "${github_team.terraform_contributors.id}"
    repository_name = "${github_repository.terraform.name}"
    permission = "push"
}

If these resources were supported then I'd use Terraform to manage our Github repos/teams (which we use for our open source projects, in contrast to our internal stuff managed in Beanstalk) in the same place as we manage our beanstalk repos/teams. In this case we actually use a preprocessing tool to generate the Terraform configs from some higher-level YAML files, so I'd also use that to maintain the links between our internal Beanstalk users and their personal Github accounts, and help us maintain the access control on our Github codebases as people join and leave the company.

@robzienert
Copy link
Contributor

My use case has been for managing github repos & teams as well within my organizations. If no one has begun work on this, I may start rifling through an initial start of resources for repositories, teams and coverage of the new org permissions essentially following what @apparentlymart outlined.

@JacobASeverson
Copy link
Contributor

This one can be closed, taken care of in ^

@mitchellh
Copy link
Contributor

Yep!

@manojlds
Copy link
Contributor

@JacobASeverson @mitchellh but are the use cases mentioned here covered by the provider as implemented? Is the github_sshkey scenario being considered?

@JacobASeverson
Copy link
Contributor

That's a good point, I guess a provider has been created but the specific resource mentioned originally wasn't implemented. Not sure if it would be better to reopen or create a new issue for that resource.

@adamhathcock
Copy link

I guess the github_repository_webhook didn't get implemented

@ghost
Copy link

ghost commented Apr 18, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants