Skip to content

Commit

Permalink
Merge branch 'master' into jfrogGH-621-bulk-import
Browse files Browse the repository at this point in the history
  • Loading branch information
chb0github authored Oct 18, 2023
2 parents d2bf147 + b49742e commit d466bde
Show file tree
Hide file tree
Showing 16 changed files with 1,618 additions and 1,443 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 9.7.0 (Oct 18, 2023). Tested on Artifactory 7.68.14 with Terraform CLI v1.6.1

IMPROVEMENTS:

* resource/artifactory_keypair is migrated to Plugin Framework. PR: [#829](https://github.com/jfrog/terraform-provider-artifactory/pull/829)
* resource/artifactory_mail_server: remove length validation for optional attribute `subject_prefix`. PR: [#830](https://github.com/jfrog/terraform-provider-artifactory/pull/830) Issue: [#828](https://github.com/jfrog/terraform-provider-artifactory/issues/828)

## 9.6.0 (Oct 13, 2023). Tested on Artifactory 7.68.14 with Terraform CLI v1.6.1

IMPROVEMENTS:
Expand Down
25 changes: 11 additions & 14 deletions docs/resources/keypair.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ subcategory: "Security"
# Artifactory keypair Resource

RSA key pairs are used to sign and verify the Alpine Linux index files in JFrog Artifactory, while GPG key pairs are
used to sign and validate packages integrity in JFrog Distribution. The JFrog Platform enables you to manage multiple
RSA and GPG signing keys through the Keys Management UI and REST API. The JFrog Platform supports managing multiple
pairs of GPG signing keys to sign packages for authentication of several package types such as Debian, Opkg, and RPM
through the Keys Management UI and REST API.
used to sign and validate packages integrity in JFrog Distribution. The JFrog Platform enables you to manage multiple RSA and GPG signing keys through the Keys Management UI and REST API. The JFrog Platform supports managing multiple pairs of GPG signing keys to sign packages for authentication of several package types such as Debian, Opkg, and RPM through the Keys Management UI and REST API.

## Example Usage

Expand All @@ -16,14 +13,15 @@ terraform {
required_providers {
artifactory = {
source = "registry.terraform.io/jfrog/artifactory"
version = "2.6.14"
version = "9.7.0"
}
}
}
resource "artifactory_keypair" "some-keypair6543461672124900137" {
pair_name = "some-keypair6543461672124900137"
resource "artifactory_keypair" "some-keypair-6543461672124900137" {
pair_name = "some-keypair-6543461672124900137"
pair_type = "RSA"
alias = "foo-alias6543461672124900137"
alias = "some-alias-6543461672124900137"
private_key = file("samples/rsa.priv")
public_key = file("samples/rsa.pub")
passphrase = "PASSPHRASE"
Expand All @@ -37,17 +35,16 @@ The following arguments are supported:
* `pair_name` - (Required) A unique identifier for the Key Pair record.
* `pair_type` - (Required) Key Pair type. Supported types - GPG and RSA.
* `alias` - (Required) Will be used as a filename when retrieving the public key via REST API.
* `private_key` - (Required, Sensitive) - Private key. PEM format will be validated.
* `private_key` - (Required, Sensitive) - Private key. PEM format will be validated. Must not include extranous spaces or tabs.
* `passphrase` - (Optional, Sensitive) Passphrase will be used to decrypt the private key. Validated server side.
* `public_key` - (Required) Public key. PEM format will be validated.
* `unavailable` - (Computed) Unknown usage. Returned in the json payload and cannot be set.
* `public_key` - (Required) Public key. PEM format will be validated. Must not include extranous spaces or tabs.

Artifactory REST API call Get Key Pair doesn't return keys `private_key` and `passphrase`, but consumes these keys in the POST call.
Artifactory REST API call 'Get Key Pair' doesn't return attributes `private_key` and `passphrase`, but consumes these keys in the POST call.

## Import

Keypair can be imported using their name, e.g.
Keypair can be imported using the pair name, e.g.

```
$ terraform import artifactory_keypair.my-keypair my-keypair
$ terraform import artifactory_keypair.my-keypair my-keypair-name
```

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -142,93 +142,91 @@ func TestAccDataSourceVirtualRpmRepository(t *testing.T) {
pair_type = "GPG"
alias = "foo-alias{{ .kp_id }}"
private_key = <<EOF
-----BEGIN PGP PRIVATE KEY BLOCK-----
lIYEYYU7tRYJKwYBBAHaRw8BAQdAZ8vVdEyrWGssb7cdreG5GDGv6taHX/vWQdDG
jn7zib/+BwMCFjb4odY28+n0NWj7KZ53BkA0qzzqT9IpIfsW/tLNPTxYEFrDVbcF
1CuiAgAhyUfBEr9HQ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iE/xs7BUH
hUTmrGN19ZC8EJQDQsXCAQDEsZV5PzynDf7HsLB3tKy7GUg44IgmywWdSED1Cyrb
AQ==
=2kMe
-----END PGP PUBLIC KEY BLOCK-----
EOF
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYYU7tRYJKwYBBAHaRw8BAQdAZ8vVdEyrWGssb7cdreG5GDGv6taHX/vWQdDG
jn7zib+0KkNocmlzdGlhbiBCb25naW9ybm8gPGNocmlzdGlhbmJAamZyb2cuY29t
PoiaBBMWCgBCFiEEksPI7fvaXVQtxrbOwL80hJIR2yQFAmGFO7UCGwMFCQPCZwAF
CwkIBwIDIgIBBhUKCQgLAgQWAgMBAh4HAheAAAoJEMC/NISSEdskUA4A/19bf4Vv
frl3UmOfRTgpYUMP7QM02Iw1viiymnWCd0QCAQCw+d64+xJ617Eqr/Vao95iezt/
Hl7udD+e7Q/BK6RzA7g4BGGFO7USCisGAQQBl1UBBQEBB0An0/o1x1ZLJRgCalWn
6HljvDcM/6Dz8zQyWxDgErDEXAMBCAeIeAQYFgoAIBYhBJLDyO372l1ULca2zsC/
NISSEdskBQJhhTu1AhsMAAoJEMC/NISSEdsk1H8BAJCMZaWOY/yliPqiE/xs7BUH
hUTmrGN19ZC8EJQDQsXCAQDEsZV5PzynDf7HsLB3tKy7GUg44IgmywWdSED1Cyrb
AQ==
=2kMe
-----END PGP PUBLIC KEY BLOCK-----
EOF
lifecycle {
ignore_changes = [
private_key,
passphrase,
]
}
}
resource "artifactory_keypair" "{{ .kp_name2 }}" {
pair_name = "{{ .kp_name2 }}"
pair_type = "GPG"
alias = "foo-alias{{ .kp_id2 }}"
private_key = <<EOF
-----BEGIN PGP PRIVATE KEY BLOCK-----
lIYEYYU7tRYJKwYBBAHaRw8BAQdAZ8vVdEyrWGssb7cdreG5GDGv6taHX/vWQdDG
jn7zib/+BwMCFjb4odY28+n0NWj7KZ53BkA0qzzqT9IpIfsW/tLNPTxYEFrDVbcF
1CuiAgAhyUfBEr9HQaMJ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xs7BUH
hUTmrGN19ZC8EJQDQsXCAQDEsZV5PzynDf7HsLB3tKy7GUg44IgmywWdSED1Cyrb
AQ==
=2kMe
-----END PGP PUBLIC KEY BLOCK-----
EOF
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYYU7tRYJKwYBBAHaRw8BAQdAZ8vVdEyrWGssb7cdreG5GDGv6taHX/vWQdDG
jn7zib+0KkNocmlzdGlhbiBCb25naW9ybm8gPGNocmlzdGlhbmJAamZyb2cuY29t
PoiaBBMWCgBCFiEEksPI7fvaXVQtxrbOwL80hJIR2yQFAmGFO7UCGwMFCQPCZwAF
CwkIBwIDIgIBBhUKCQgLAgQWAgMBAh4HAheAAAoJEMC/NISSEdskUA4A/19bf4Vv
frl3UmOfRTgpYUMP7QM02Iw1viiymnWCd0QCAQCw+d64+xJ617Eqr/Vao95iezt/
Hl7udD+e7Q/BK6RzA7g4BGGFO7USCisGAQQBl1UBBQEBB0An0/o1x1ZLJRgCalWn
6HljvDcM/6Dz8zQyWxDgErDEXAMBCAeIeAQYFgoAIBYhBJLDyO372l1ULca2zsC/
NISSEdskBQJhhTu1AhsMAAoJEMC/NISSEdsk1H8BAJCMZaWOY/yliPqiE/xs7BUH
hUTmrGN19ZC8EJQDQsXCAQDEsZV5PzynDf7HsLB3tKy7GUg44IgmywWdSED1Cyrb
AQ==
=2kMe
-----END PGP PUBLIC KEY BLOCK-----
EOF
lifecycle {
ignore_changes = [
private_key,
passphrase,
]
}
}
resource "artifactory_virtual_rpm_repository" "{{ .repo_name }}" {
key = "{{ .repo_name }}"
primary_keypair_ref = artifactory_keypair.{{ .kp_name }}.pair_name
Expand All @@ -253,8 +251,8 @@ func TestAccDataSourceVirtualRpmRepository(t *testing.T) {
}) // we use randomness so that, in the case of failure and dangle, the next test can run without collision

resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t) },
ProviderFactories: acctest.ProviderFactories,
PreCheck: func() { acctest.PreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5MuxProviderFactories,
CheckDestroy: acctest.CompositeCheckDestroy(
acctest.VerifyDeleted(fqrn, acctest.CheckRepo),
acctest.VerifyDeleted(kpFqrn, security.VerifyKeyPair),
Expand Down
1 change: 1 addition & 0 deletions pkg/artifactory/provider/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func (p *ArtifactoryProvider) Resources(ctx context.Context) []func() resource.R
security.NewGlobalEnvironmentResource,
security.NewDistributionPublicKeyResource,
security.NewCertificateResource,
security.NewKeyPairResource,
configuration.NewLdapSettingResource,
configuration.NewLdapGroupSettingResource,
configuration.NewBackupResource,
Expand Down
1 change: 0 additions & 1 deletion pkg/artifactory/provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

func resourcesMap() map[string]*schema.Resource {
resourcesMap := map[string]*schema.Resource{
"artifactory_keypair": security.ResourceArtifactoryKeyPair(),
"artifactory_federated_alpine_repository": federated.ResourceArtifactoryFederatedAlpineRepository(),
"artifactory_federated_cargo_repository": federated.ResourceArtifactoryFederatedCargoRepository(),
"artifactory_federated_conan_repository": federated.ResourceArtifactoryFederatedConanRepository(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ func (r *MailServerResource) Schema(ctx context.Context, req resource.SchemaRequ
"subject_prefix": schema.StringAttribute{
MarkdownDescription: "A prefix to use for the subject of all outgoing mails.",
Optional: true,
Validators: []validator.String{
stringvalidator.LengthAtLeast(1),
},
},
"use_ssl": schema.BoolAttribute{
MarkdownDescription: "When set to 'true', uses a secure connection to the mail server.",
Expand Down
Loading

0 comments on commit d466bde

Please sign in to comment.