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

feat: Ability to Manage Codespaces Secrets #1729

Merged
merged 16 commits into from
Jun 27, 2023

Conversation

KenSpur
Copy link
Contributor

@KenSpur KenSpur commented Jun 16, 2023

Resolves #1662 #915


Behavior

Before the change?

  • No Ability to Manage Codespaces Secrets

After the change?

  • Ability to Manage Codespaces Secrets using:
    • resource github_codespaces_secret & data github_codespaces_secrets, github_codespaces_public_key
    • resource github_codespaces_organization_secret & data github_codespaces_organization_secrets, github_codespaces_organization_public_key
    • resource github_codespaces_user_secret & data github_codespaces_user_secrets, github_codespaces_user_public_key

Other information

  • Currently blocked by the implementation of the 'go-github' client go-github/issues/2362 which is getting there.

Additional info

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

Pull request type

Type: Feature

@KenSpur
Copy link
Contributor Author

KenSpur commented Jun 16, 2023

The 'go-github' client still needs to be updated once its ready

@KenSpur KenSpur changed the title Ability to Manage Codespaces Secrets, Type: Feature Ability to Manage Codespaces Secrets Type: Feature Jun 16, 2023
@KenSpur KenSpur changed the title Ability to Manage Codespaces Secrets Type: Feature Feat: Ability to Manage Codespaces Secrets Jun 16, 2023
@KenSpur KenSpur changed the title Feat: Ability to Manage Codespaces Secrets feat: Ability to Manage Codespaces Secrets Jun 16, 2023
@KenSpur KenSpur mentioned this pull request Jun 19, 2023
1 task
@kfcampbell
Copy link
Member

@KenSpur thank you for contributing! Do you mind adding the corresponding documentation and link to documentation in the github.erb file for these new resources and data sources?

@KenSpur
Copy link
Contributor Author

KenSpur commented Jun 21, 2023

@kfcampbell Yes will do, also looking into testing etc.

@kfcampbell
Copy link
Member

@KenSpur thank you for contributing? Is this ready for review/merging?

@KenSpur
Copy link
Contributor Author

KenSpur commented Jun 23, 2023

@kfcampbell I was able to manualy test the 'github_codespaces_secret' and 'github_codespaces_secret'.

Concerning 'github_codespaces_organization_secret' i am getting 404's which might be because of my token and org config, since when i uses the api or cli i get the same.

Automated testing still needs a look which ill do today.

Also i have found a bug in how the repo secrets handle an update to the repoName, they should probably forceNew as its used in the resource id which can't handle changes if im correct. I am wondering if i should fix this in this PR or keep it similar to the other secrets and fix it later?

Il update my progress later today.

@KenSpur
Copy link
Contributor Author

KenSpur commented Jun 23, 2023

Ah found the issue concerning the 404's on 'github_codespaces_organization_secret', i needed to upgrade my account to the 4$ plan.

It is weird though and might be a bug in the api because manualy trough the webapp i was able to create a codespace secret on the non upgraded org on 06/21 (2days ago).

@KenSpur
Copy link
Contributor Author

KenSpur commented Jun 23, 2023

@kfcampbell ready for review/merging!

Ill open a bug Issue concerning repository renames, so that all repo secrets can be fixed at once in a focused manner ^^ (#1753)

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

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

I had a question around importation, otherwise this looks good to me.

Read: resourceGithubCodespacesSecretRead,
Update: resourceGithubCodespacesSecretCreateOrUpdate,
Delete: resourceGithubCodespacesSecretDelete,

Copy link
Member

Choose a reason for hiding this comment

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

Why does this resource not support importing?

Copy link
Contributor Author

@KenSpur KenSpur Jun 27, 2023

Choose a reason for hiding this comment

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

It seems to not be implemented on the resourceGithubActionsSecret or resourceGithubDependabotSecret aswel, though org secrets do have it. Should i open an issue to look into all 3?

Copy link
Member

Choose a reason for hiding this comment

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

@KenSpur that would be excellent, thanks! In an ideal world, each resource should support importing.

## Attributes Reference

* `created_at` - Date of actions_secret creation.
* `updated_at` - Date of actions_secret update.
Copy link
Member

Choose a reason for hiding this comment

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

If/when import is added for codespaces secrets, we should update this doc here.

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

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

I'm happy to have importing tackled in separate PRs. Thank you for contributing!

@kfcampbell kfcampbell merged commit 498907b into integrations:main Jun 27, 2023
doonga referenced this pull request in doonga/greyrock-ops Jun 29, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github](https://registry.terraform.io/providers/integrations/github)
([source](https://togithub.com/integrations/terraform-provider-github))
| required_provider | minor | `5.28.1` -> `5.29.0` |

---

### Release Notes

<details>
<summary>integrations/terraform-provider-github (github)</summary>

###
[`v5.29.0`](https://togithub.com/integrations/terraform-provider-github/releases/tag/v5.29.0)

[Compare
Source](https://togithub.com/integrations/terraform-provider-github/compare/v5.28.1...v5.29.0)

#### What's Changed

- fix: support team slug in github_team_membership by
[@&#8203;kristian-lesko](https://togithub.com/kristian-lesko) in
[https://github.com/integrations/terraform-provider-github/pull/1751](https://togithub.com/integrations/terraform-provider-github/pull/1751)
- Fixes accidental deletion of Repository resource from state by
[@&#8203;t0yv0](https://togithub.com/t0yv0) in
[https://github.com/integrations/terraform-provider-github/pull/1750](https://togithub.com/integrations/terraform-provider-github/pull/1750)
- feat: Add GitHub Organization Custom Role Resource and Data Source by
[@&#8203;cailen](https://togithub.com/cailen) in
[https://github.com/integrations/terraform-provider-github/pull/1700](https://togithub.com/integrations/terraform-provider-github/pull/1700)
- Fix typo in deployment branch policy import by
[@&#8203;bpaquet](https://togithub.com/bpaquet) in
[https://github.com/integrations/terraform-provider-github/pull/1758](https://togithub.com/integrations/terraform-provider-github/pull/1758)
- Fix `resourceGithubDependabotOrganizationSecretCreateOrUpdate` by
[@&#8203;frankywahl](https://togithub.com/frankywahl) in
[https://github.com/integrations/terraform-provider-github/pull/1759](https://togithub.com/integrations/terraform-provider-github/pull/1759)
- \[Bug]: Renaming github_repository doesn't taint full_name attribute
by [@&#8203;KenSpur](https://togithub.com/KenSpur) in
[https://github.com/integrations/terraform-provider-github/pull/1756](https://togithub.com/integrations/terraform-provider-github/pull/1756)
- feat: Ability to Manage Codespaces Secrets by
[@&#8203;KenSpur](https://togithub.com/KenSpur) in
[https://github.com/integrations/terraform-provider-github/pull/1729](https://togithub.com/integrations/terraform-provider-github/pull/1729)

#### New Contributors

- [@&#8203;kristian-lesko](https://togithub.com/kristian-lesko) made
their first contribution in
[https://github.com/integrations/terraform-provider-github/pull/1751](https://togithub.com/integrations/terraform-provider-github/pull/1751)
- [@&#8203;t0yv0](https://togithub.com/t0yv0) made their first
contribution in
[https://github.com/integrations/terraform-provider-github/pull/1750](https://togithub.com/integrations/terraform-provider-github/pull/1750)
- [@&#8203;cailen](https://togithub.com/cailen) made their first
contribution in
[https://github.com/integrations/terraform-provider-github/pull/1700](https://togithub.com/integrations/terraform-provider-github/pull/1700)
- [@&#8203;frankywahl](https://togithub.com/frankywahl) made their first
contribution in
[https://github.com/integrations/terraform-provider-github/pull/1759](https://togithub.com/integrations/terraform-provider-github/pull/1759)
- [@&#8203;KenSpur](https://togithub.com/KenSpur) made their first
contribution in
[https://github.com/integrations/terraform-provider-github/pull/1756](https://togithub.com/integrations/terraform-provider-github/pull/1756)

**Full Changelog**:
integrations/terraform-provider-github@v5.28.1...v5.29.0

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **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:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMCIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: greyrock-bot <1583719+greyrock-bot[bot]@users.noreply.github.com>
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
* add github_codespaces_secret

* use repository as repoName

* add github_codespaces_organization_secret

* add github_codespaces_user_secret

* fix version

* add docs

* fix id conversion

* add codespaces_*public_key data source

* switch back to use of name/full_name

* update org test

* update repo test

* remove user secret visibiltiy prop & update tests

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.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.

[FEAT]: Ability to Manage Codespaces Secrets
2 participants