-
Notifications
You must be signed in to change notification settings - Fork 24
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 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 6fad9dc
Add emails
mathieu-lemay ed385ff
Add subkeys
mathieu-lemay dd055ab
Generate
mathieu-lemay e212900
Update example comments
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,83 @@ | ||
| --- | ||
| # 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 authenticated 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. | ||
| - `emails` (List of Object) Emails associated with the GPG key. (see [below for nested schema](#nestedatt--emails)) | ||
| - `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. | ||
| - `subkeys` (List of Object) Subkeys of the GPG key. (see [below for nested schema](#nestedatt--subkeys)) | ||
|
|
||
| <a id="nestedatt--emails"></a> | ||
| ### Nested Schema for `emails` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `email` (String) | ||
| - `verified` (Boolean) | ||
|
|
||
|
|
||
| <a id="nestedatt--subkeys"></a> | ||
| ### Nested Schema for `subkeys` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `can_certify` (Boolean) | ||
| - `can_encrypt_comms` (Boolean) | ||
| - `can_encrypt_storage` (Boolean) | ||
| - `can_sign` (Boolean) | ||
| - `created_at` (String) | ||
| - `expires_at` (String) | ||
| - `id` (Number) | ||
| - `key_id` (String) | ||
| - `primary_key_id` (String) | ||
| - `public_key` (String) |
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,94 @@ | ||
| --- | ||
| # 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 = "test_user@localhost.localdomain" | ||
| }] | ||
| passphrase = var.gpg_key_password | ||
| } | ||
|
|
||
| # Forgejo GPG key | ||
| resource "forgejo_gpg_key" "this" { | ||
| # There is no user for this resource, GPG keys can only be managed for the authenticated user. | ||
| 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. | ||
| - `emails` (List of Object) Emails associated with the GPG key. (see [below for nested schema](#nestedatt--emails)) | ||
| - `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. | ||
| - `subkeys` (List of Object) Subkeys of the GPG key. (see [below for nested schema](#nestedatt--subkeys)) | ||
|
|
||
| <a id="nestedatt--emails"></a> | ||
| ### Nested Schema for `emails` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `email` (String) | ||
| - `verified` (Boolean) | ||
|
|
||
|
|
||
| <a id="nestedatt--subkeys"></a> | ||
| ### Nested Schema for `subkeys` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `can_certify` (Boolean) | ||
| - `can_encrypt_comms` (Boolean) | ||
| - `can_encrypt_storage` (Boolean) | ||
| - `can_sign` (Boolean) | ||
| - `created_at` (String) | ||
| - `expires_at` (String) | ||
| - `id` (Number) | ||
| - `key_id` (String) | ||
| - `primary_key_id` (String) | ||
| - `public_key` (String) |
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 authenticated 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,31 @@ | ||
| 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 = "test_user@localhost.localdomain" | ||
| }] | ||
| passphrase = var.gpg_key_password | ||
| } | ||
|
|
||
| # Forgejo GPG key | ||
| resource "forgejo_gpg_key" "this" { | ||
| # There is no user for this resource, GPG keys can only be managed for the authenticated user. | ||
| armored_public_key = gpg_key_pair.test.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
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.
Let's add a comment that there's no
userargument here. GPG keys can only be managed for the authenticated user...