-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cced478
commit 08682d2
Showing
13 changed files
with
859 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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,75 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "argocd_gpg_key Resource - terraform-provider-argocd" | ||
subcategory: "" | ||
description: |- | ||
Manages GPG keys https://argo-cd.readthedocs.io/en/stable/user-guide/gpg-verification/ within ArgoCD. | ||
--- | ||
|
||
# argocd_gpg_key (Resource) | ||
|
||
Manages [GPG keys](https://argo-cd.readthedocs.io/en/stable/user-guide/gpg-verification/) within ArgoCD. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "argocd_gpg_key" "this" { | ||
public_key = <<EOF | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
mQINBGSJdlcBEACnza+KvWLyKWUHJPhgs//HRL0EEmA/EcFKioBlrgPNYf/O7hNg | ||
KT3NDaNrD26pr+bOb4mfaqNNS9no8b9EP3C7Co3Wf2d4xpJ5/hlpIm3V652S5daZ | ||
I7ylVT8QOrhaqEnHH2hEcOfDaqjrYfrx3qiI8v7DmV6jfGi1tDUUgfJwiOyZk4q1 | ||
jiPo5k4+XNp9mCtUAGyidLFcUqQ9XbHKgBwgAoxtIKNSbdPCGhsjgTHHhzswMH/Z | ||
DhhtcraqrfOhoP9lI4/zyCS+B9OfUy7BS/1SqWKIgdsjFIR+zHIOI69lh77+ZAVE | ||
MVYJBdFke5/g/tTPaQGuBqaIJ3d/Mi/ZlbTsoBcq5qam73uh7fcgBV5la6NeuNcR | ||
tvKMVl4DlnkJS8LBtElLEeHEylTCdNltrUFwshDKDBtq6ilTKCK14R6g4lkn8VcE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rD0Qr9ULXfphZdrv | ||
xga7/lyQLmukLu7Mxwp+ss2bY/wjT8mlT5P55kBpXXyYILhLsUESCHG6D8/Ov+vv | ||
OoZS+BSfe/0vc1aTfDKxj5wAx27a6z5o25X27feEl3U= | ||
=kqkH | ||
-----END PGP PUBLIC KEY BLOCK----- | ||
EOF | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `public_key` (String) Raw key data of the GPG key to create | ||
|
||
### Read-Only | ||
|
||
- `fingerprint` (String) Fingerprint is the fingerprint of the key | ||
- `id` (String) GPG key identifier | ||
- `owner` (String) Owner holds the owner identification, e.g. a name and e-mail address | ||
- `sub_type` (String) SubType holds the key's sub type (e.g. rsa4096) | ||
- `trust` (String) Trust holds the level of trust assigned to this key | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# GPG Keys can be imported using the key ID. | ||
|
||
# Example: | ||
terraform import argocd_gpg_key.this 9AD92955401D388D | ||
``` |
This file contains 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,4 @@ | ||
# GPG Keys can be imported using the key ID. | ||
|
||
# Example: | ||
terraform import argocd_gpg_key.this 9AD92955401D388D |
This file contains 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,33 @@ | ||
resource "argocd_gpg_key" "this" { | ||
public_key = <<EOF | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
mQINBGSJdlcBEACnza+KvWLyKWUHJPhgs//HRL0EEmA/EcFKioBlrgPNYf/O7hNg | ||
KT3NDaNrD26pr+bOb4mfaqNNS9no8b9EP3C7Co3Wf2d4xpJ5/hlpIm3V652S5daZ | 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IXHtrj7r1z6XTDAEkGeBg | ||
HXW8IEhZDE1Nq3vQtZvgwftEoPT/Ff+8DwvL1JUov2ObQDolallzKaiiVfGZhPJZ | ||
4PMtEPEmSL9QWJAG5jiBVC3BdVZtXBNkC1HqTCXwZc/wzp5O9MmMXmCrUFr4FfHu | ||
IZ560MNpp/SrtUrOahLmvuG0B+Ze96e2nm5ap5wkCDaQouOIqM7Lj+FGq64cu2B/ | ||
oSsl7joBZQUYXv8meNOQssm6jArRLG2oFoiEdRqzd2/RjvvJliLN9OCNvV43f38h | ||
8Ep8RDi9RiHhSKvwrvDD9x/JRm6zQUetjrctmjdIYp8k129LrD0Qr9ULXfphZdrv | ||
xga7/lyQLmukLu7Mxwp+ss2bY/wjT8mlT5P55kBpXXyYILhLsUESCHG6D8/Ov+vv | ||
OoZS+BSfe/0vc1aTfDKxj5wAx27a6z5o25X27feEl3U= | ||
=kqkH | ||
-----END PGP PUBLIC KEY BLOCK----- | ||
EOF | ||
} |
This file contains 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 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 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,63 @@ | ||
package provider | ||
|
||
import ( | ||
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" | ||
"github.com/hashicorp/terraform-plugin-framework/resource/schema" | ||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" | ||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" | ||
"github.com/hashicorp/terraform-plugin-framework/types" | ||
customtypes "github.com/oboukili/terraform-provider-argocd/internal/types" | ||
) | ||
|
||
type gpgKeyModel struct { | ||
ID types.String `tfsdk:"id"` | ||
PublicKey customtypes.PGPPublicKey `tfsdk:"public_key"` | ||
Fingerprint types.String `tfsdk:"fingerprint"` | ||
Owner types.String `tfsdk:"owner"` | ||
SubType types.String `tfsdk:"sub_type"` | ||
Trust types.String `tfsdk:"trust"` | ||
} | ||
|
||
func gpgKeySchemaAttributes() map[string]schema.Attribute { | ||
return map[string]schema.Attribute{ | ||
"public_key": schema.StringAttribute{ | ||
MarkdownDescription: "Raw key data of the GPG key to create", | ||
CustomType: customtypes.PGPPublicKeyType, | ||
Required: true, | ||
PlanModifiers: []planmodifier.String{ | ||
stringplanmodifier.RequiresReplace(), | ||
}, | ||
}, | ||
"fingerprint": schema.StringAttribute{ | ||
MarkdownDescription: "Fingerprint is the fingerprint of the key", | ||
Computed: true, | ||
}, | ||
"id": schema.StringAttribute{ | ||
MarkdownDescription: "GPG key identifier", | ||
Computed: true, | ||
}, | ||
"owner": schema.StringAttribute{ | ||
MarkdownDescription: "Owner holds the owner identification, e.g. a name and e-mail address", | ||
Computed: true, | ||
}, | ||
"sub_type": schema.StringAttribute{ | ||
MarkdownDescription: "SubType holds the key's sub type (e.g. rsa4096)", | ||
Computed: true, | ||
}, | ||
"trust": schema.StringAttribute{ | ||
MarkdownDescription: "Trust holds the level of trust assigned to this key", | ||
Computed: true, | ||
}, | ||
} | ||
} | ||
|
||
func newGPGKey(k *v1alpha1.GnuPGPublicKey) *gpgKeyModel { | ||
return &gpgKeyModel{ | ||
Fingerprint: types.StringValue(k.Fingerprint), | ||
ID: types.StringValue(k.KeyID), | ||
Owner: types.StringValue(k.Owner), | ||
PublicKey: customtypes.PGPPublicKeyValue(k.KeyData), | ||
SubType: types.StringValue(k.SubType), | ||
Trust: types.StringValue(k.Trust), | ||
} | ||
} |
This file contains 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.