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

allow creation of registry module via Github app #935

Merged
merged 4 commits into from
Jun 28, 2023

Conversation

dsa0x
Copy link
Contributor

@dsa0x dsa0x commented Jun 19, 2023

Description

This PR fixes a bug that prevented users from being able to create a registry module using a github app. As defined by our API docs, an organization is required for the endpoint. For gh_oauth provider, the organization is already in the context via the tfe_oauth_client resource, but it needs to be explicitly added when creating with github-app. The module is created in the provided organization

Testing plan

  1. The test should pass.
  2. Creating a module using the github app should succeed with a 201 status code
data "tfe_github_app_installation" "gha_installation" {
  name = "YOUR_GH_NAME"
}

resource "tfe_registry_module" "petstore" {
  organization_name = tfe_organization.foobar2
  vcs_repo {
    display_identifier = "GH_NAME/REPO_NAME"
    identifier         = "GH_NAME/REPO_NAME"
    github_app_installation_id     = data.tfe_github_app_installation.gha_installation.id
  }
}

External links

@dsa0x dsa0x force-pushed the sams/fix-registry-module-vcs-create branch from c2bede2 to 02e9aca Compare June 19, 2023 19:23
@dsa0x dsa0x marked this pull request as ready for review June 20, 2023 08:51
@dsa0x dsa0x requested a review from a team as a code owner June 20, 2023 08:51
Copy link
Member

@nfagerlund nfagerlund left a comment

Choose a reason for hiding this comment

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

OK, this is good! I tested it out and it behaved as expected, and the code makes sense.

There's one doc typo, after which this is mergeable.

website/docs/r/registry_module.html.markdown Outdated Show resolved Hide resolved
Co-authored-by: Nick Fagerlund <nick.fagerlund@gmail.com>
@dsa0x dsa0x requested a review from nfagerlund June 28, 2023 06:53
@dsa0x dsa0x merged commit 519f459 into main Jun 28, 2023
@dsa0x dsa0x deleted the sams/fix-registry-module-vcs-create branch June 28, 2023 19:58
github-merge-queue bot referenced this pull request in panda-den/colorful-pandas Jul 4, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tfe](https://registry.terraform.io/providers/hashicorp/tfe)
([source](https://togithub.com/hashicorp/terraform-provider-tfe)) |
required_provider | minor | `0.45.0` -> `0.46.0` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>hashicorp/terraform-provider-tfe (tfe)</summary>

###
[`v0.46.0`](https://togithub.com/hashicorp/terraform-provider-tfe/blob/HEAD/CHANGELOG.md#v0460-July-3-2023)

[Compare
Source](https://togithub.com/hashicorp/terraform-provider-tfe/compare/v0.45.0...v0.46.0)

FEATURES:

- **New Resource**: `r/tfe_agent_pool_allowed_workspaces` restricts the
use of an agent pool to particular workspaces, by
[@&#8203;hs26gill](https://togithub.com/hs26gill)
[870](https://togithub.com/hashicorp/terraform-provider-tfe/pull/870)
- `r/tfe_organization_token`: Add optional `expired_at` field to
organization tokens, by
[@&#8203;juliannatetreault](https://togithub.com/juliannatetreault)
(#&#8203[https://github.com/hashicorp/terraform-provider-tfe/pull/844](https://togithub.com/hashicorp/terraform-provider-tfe/pull/844)ll/844))
- `r/tfe_team_token`: Add optional `expired_at` field to team tokens, by
[@&#8203;juliannatetreault](https://togithub.com/juliannatetreault)
(#&#8203[https://github.com/hashicorp/terraform-provider-tfe/pull/844](https://togithub.com/hashicorp/terraform-provider-tfe/pull/844)ll/844))
- `r/tfe_agent_pool`: Add attribute `organization_scoped` to set the
scope of an agent pool, by
[@&#8203;hs26gill](https://togithub.com/hs26gill)
[870](https://togithub.com/hashicorp/terraform-provider-tfe/pull/870)
- `d/tfe_agent_pool`: Add attribute `organization_scoped` and
`allowed_workspace_ids` to retrieve agent pool scope and associated
allowed workspace ids, by
[@&#8203;hs26gill](https://togithub.com/hs26gill)
[870](https://togithub.com/hashicorp/terraform-provider-tfe/pull/870)

BUG FIXES:

- `r/tfe_workspace_run`: Ensure `wait_for_run` correctly results in a
fire-and-forget run when set to `false`, by
[@&#8203;lucymhdavies](https://togithub.com/lucymhdavies)
(#&#8203[https://github.com/hashicorp/terraform-provider-tfe/pull/910](https://togithub.com/hashicorp/terraform-provider-tfe/pull/910)ll/910))
- `r/tfe_workspace_run`: Fix rare random run failures; adjust lists of
expected run statuses to ensure that a plan is completely processed
before attempting to apply it, by
[@&#8203;uk1288](https://togithub.com/uk1288)
(#&#8203[https://github.com/hashicorp/terraform-provider-tfe/pull/921](https://togithub.com/hashicorp/terraform-provider-tfe/pull/921)ll/921))
- `r/tfe_notification_configuration`: Add support for missing "Check
failed" Health Event notifications, by
[@&#8203;lucymhdavies](https://togithub.com/lucymhdavies)
(#&#8203[https://github.com/hashicorp/terraform-provider-tfe/pull/927](https://togithub.com/hashicorp/terraform-provider-tfe/pull/927)ll/927))
- `r/tfe_registry_module`: Fix a bug that prevented users from being
able to create a registry module using a github app, by
[@&#8203;dsa0x](https://togithub.com/dsa0x)
(#&#8203[https://github.com/hashicorp/terraform-provider-tfe/pull/935](https://togithub.com/hashicorp/terraform-provider-tfe/pull/935)ll/935))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNTkuNCIsInVwZGF0ZWRJblZlciI6IjM1LjE1OS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: astronaut-panda[bot] <137164246+astronaut-panda[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants