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

resource/github_repository: Allow setting default_branch to master on creation #150

Merged
merged 3 commits into from
Jul 18, 2019

Conversation

ctrom
Copy link
Contributor

@ctrom ctrom commented Sep 7, 2018

Fixes #146.

@ghost ghost added the size/XS label Sep 7, 2018
@ctrom ctrom changed the title resource/github_repository: Allow setting default branch to master fo… resource/github_repository: Allow setting default branch to master for new repo Sep 7, 2018
@radeksimko radeksimko added the Type: Feature New feature or request label Sep 11, 2018
@ctrom
Copy link
Contributor Author

ctrom commented Sep 11, 2018

@radeksimko could I get a review on this?

Copy link
Contributor

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ctrom
thanks for the PR.

I have basically two notes/questions:

  • Can we instead make this work by calling Update() function right after creation? We do this in many other providers for the same reason (when certain attributes can only be updated, but not passed during creation).
  • Can we test this via an acceptance test?

@ctrom
Copy link
Contributor Author

ctrom commented Sep 14, 2018

@radeksimko

  • It isn't possible to set a default branch when creating a repo, but regardless of the value that is passed for the default branch, GitHub will set the default branch to master. As a result, I don't think it makes a difference whether we do this on create or update. Really what I want to achieve here is that since GitHub sets the default branch to master when a repo is created, I want the Terraform state to reflect that.
  • Perhaps I'm missing it, but I don't see an acceptance test for repo creation. I can attempt to create a new acceptance test for this, but I don't have a lot of experience with golang yet, so please be patient with me while I do.

@ewoutp
Copy link

ewoutp commented Jan 17, 2019

This PR would be a big help.
I'm using github_repository in a module and I right now cannot set the default_branch argument at all.
I like to set it to something like "${var.default_branch}".

This PR would enable me to do so.

Then in the place where I use the module, I could start with default_branch = "master" and later change that to default_branch = "something-else"

@ghost ghost removed the Awaiting response label Jan 17, 2019
@ctrom
Copy link
Contributor Author

ctrom commented Jan 17, 2019

@ewoutp Your situation sounds just like mine. Unfortunately, I don't know enough about golang to finish this quickly and can't take the time right now to learn it. Maybe someone else would be able to take a stab at it?

@tracypholmes tracypholmes self-assigned this Jun 28, 2019
Copy link
Contributor

@tracypholmes tracypholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ctrom and thanks for the PR! It LGTM but needs a test in order to make sure things work. I hope you don't mind, but I went on and added a test so we can get this merged 😄

@tracypholmes tracypholmes changed the title resource/github_repository: Allow setting default branch to master for new repo resource/github_repository: Allow setting default_branch to master on creation Jul 18, 2019
@tracypholmes tracypholmes merged commit 45fb8bf into integrations:master Jul 18, 2019
tracypholmes added a commit that referenced this pull request Jul 18, 2019
@ctrom ctrom deleted the AllowDefaultMaster branch July 19, 2019 15:17
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
…tegrations#150)

* resource/github_repository: Allow setting default branch to master for new repo

* Adds test to validate repository can be set to master as default upon creation
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot set the default branch on a new repository
5 participants