-
Notifications
You must be signed in to change notification settings - Fork 7
Add GPG Key resource and data source #85
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
Open
mathieu-lemay
wants to merge
10
commits into
svalabs:main
Choose a base branch
from
mathieu-lemay:add-gpg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f22c14d
Add GPG Key resource and data source
mathieu-lemay 3052b48
Address comments
mathieu-lemay 81de91d
Add support for other user in data source
mathieu-lemay b77cbce
Move forgejoEmail const
mathieu-lemay 6c35089
Move use gpg provider
mathieu-lemay 7a6b9cf
Update doc
mathieu-lemay 50da96b
Add examples
mathieu-lemay 7bb55e8
gpg_key -> gpg_key_pair
mathieu-lemay e453a03
fmt
mathieu-lemay c478182
make gen
mathieu-lemay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "forgejo_gpg_key Data Source - forgejo" | ||
| subcategory: "" | ||
| description: |- | ||
| Forgejo user GPG key data source. | ||
| --- | ||
|
|
||
| # forgejo_gpg_key (Data Source) | ||
|
|
||
| Forgejo user GPG key data source. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| terraform { | ||
| required_providers { | ||
| forgejo = { | ||
| source = "svalabs/forgejo" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "forgejo" { | ||
| host = "http://localhost:3000" | ||
| } | ||
|
|
||
| # Existing GPG key | ||
| data "forgejo_gpg_key" "this" { | ||
| user = "test_user" # Optional, uses api key's user if not provided | ||
| key_id = "test_key" | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `key_id` (String) ID of the GPG key. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `user` (String) Name of the user. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `can_certify` (Boolean) Can this key certify. | ||
| - `can_encrypt_comms` (Boolean) Can this key encrypt communications. | ||
| - `can_encrypt_storage` (Boolean) Can this key encrypt storage. | ||
| - `can_sign` (Boolean) Can this key sign. | ||
| - `created_at` (String) Time at which the GPG key was created. | ||
| - `expires_at` (String) Time at which the GPG key expires. | ||
| - `id` (Number) Numeric identifier of the GPG key. | ||
| - `primary_key_id` (String) Primary ID of the GPG key. | ||
| - `public_key` (String) The public key. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "forgejo_gpg_key Resource - forgejo" | ||
| subcategory: "" | ||
| description: |- | ||
| Forgejo user GPG key resource. | ||
| --- | ||
|
|
||
| # forgejo_gpg_key (Resource) | ||
|
|
||
| Forgejo user GPG key resource. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| terraform { | ||
| required_providers { | ||
| forgejo = { | ||
| source = "svalabs/forgejo" | ||
| } | ||
| gpg = { | ||
| source = "terraform-provider-gpg/gpg" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| variable "gpg_key_password" { sensitive = true } | ||
|
|
||
| provider "forgejo" { | ||
| host = "http://localhost:3000" | ||
| } | ||
|
|
||
| # GPG key | ||
| resource "gpg_key_pair" "test" { | ||
| identities = [{ | ||
| name = "Test User" | ||
| email = "[email protected]" | ||
| }] | ||
| passphrase = var.gpg_key_password | ||
| } | ||
|
|
||
| # Forgejo GPG key | ||
| resource "forgejo_gpg_key" "this" { | ||
| armored_public_key = gpg_key_pair.test.public_key | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `armored_public_key` (String) Armored GPG Public key. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `can_certify` (Boolean) Can this key certify. | ||
| - `can_encrypt_comms` (Boolean) Can this key encrypt communications. | ||
| - `can_encrypt_storage` (Boolean) Can this key encrypt storage. | ||
| - `can_sign` (Boolean) Can this key sign. | ||
| - `created_at` (String) Time at which the GPG key was created. | ||
| - `expires_at` (String) Time at which the GPG key expires. | ||
| - `id` (Number) Numeric identifier of the GPG key. | ||
| - `key_id` (String) ID of the GPG key. | ||
| - `primary_key_id` (String) Primary ID of the GPG key. | ||
| - `public_key` (String) The public key. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| terraform { | ||
| required_providers { | ||
| forgejo = { | ||
| source = "svalabs/forgejo" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "forgejo" { | ||
| host = "http://localhost:3000" | ||
| } | ||
|
|
||
| # Existing GPG key | ||
| data "forgejo_gpg_key" "this" { | ||
| user = "test_user" # Optional, uses api key's user if not provided | ||
| key_id = "test_key" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| terraform { | ||
| required_providers { | ||
| forgejo = { | ||
| source = "svalabs/forgejo" | ||
| } | ||
| gpg = { | ||
| source = "terraform-provider-gpg/gpg" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| variable "gpg_key_password" { sensitive = true } | ||
|
|
||
| provider "forgejo" { | ||
| host = "http://localhost:3000" | ||
| } | ||
|
|
||
| # GPG key | ||
| resource "gpg_key_pair" "test" { | ||
| identities = [{ | ||
| name = "Test User" | ||
| email = "[email protected]" | ||
| }] | ||
| passphrase = var.gpg_key_password | ||
| } | ||
|
|
||
| # Forgejo GPG key | ||
| resource "forgejo_gpg_key" "this" { | ||
| armored_public_key = gpg_key_pair.test.public_key | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a comment that there's no |
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of
... api key's user ..., let's call this... authenticated user ...(for consistency).Sorry for being picky - it's my inner monk ;-)