Skip to content

Commit

Permalink
Merge pull request #66 from jfrog/update-for-fixed-project-key-valida…
Browse files Browse the repository at this point in the history
…tion

Update key validation
  • Loading branch information
alexhung authored Dec 21, 2022
2 parents 3862b53 + c6ccd31 commit 58e1c62
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.1.12 (Dec 22, 2022). Tested on Artifactory 7.47.14 and Xray 3.62.4

BUG FIXES:

* resource/project: Update `key` attribute validation to match Artifactory Project. PR: [#66](https://github.com/jfrog/terraform-provider-project/pull/66)

## 1.1.11 (Dec 13, 2022).

IMPROVEMENTS:
Expand Down
4 changes: 3 additions & 1 deletion docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ resource "project" "myproject" {

- `admin_privileges` (Block Set, Min: 1) (see [below for nested schema](#nestedblock--admin_privileges))
- `display_name` (String) Also known as project name on the UI
- `key` (String) The Project Key is added as a prefix to resources created within a Project. This field is mandatory and supports only 3 - 10 lowercase alphanumeric and hyphen characters. Must begin with a letter. For example: `us1a-test`.
- `key` (String) The Project Key is added as a prefix to resources created within a Project. This field is mandatory and supports only 2 - 10 lowercase alphanumeric and hyphen characters. Must begin with a letter. For example: `us1a-test`.

### Optional

Expand Down Expand Up @@ -170,3 +170,5 @@ Required:
Optional:

- `description` (String)


2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require (
github.com/hashicorp/terraform-plugin-docs v0.7.0
github.com/hashicorp/terraform-plugin-log v0.3.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.14.0
github.com/jfrog/terraform-provider-shared v1.7.0
github.com/jfrog/terraform-provider-shared v1.8.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jfrog/terraform-provider-shared v1.7.0 h1:1rVylhL9W5YDKq4zXU1gISRitmeyg8lu7H8u+wP4544=
github.com/jfrog/terraform-provider-shared v1.7.0/go.mod h1:oIzDjD2mOlfXymkzwp5kbFG3Bqy3ymVGYX50CrCxiIE=
github.com/jfrog/terraform-provider-shared v1.8.0 h1:kaAN8/F1NgZa+V/LbDYUHk3hzCxa5yISBqak7NHvCmI=
github.com/jfrog/terraform-provider-shared v1.8.0/go.mod h1:oIzDjD2mOlfXymkzwp5kbFG3Bqy3ymVGYX50CrCxiIE=
github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=
github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
Expand Down
2 changes: 1 addition & 1 deletion pkg/project/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func projectResource() *schema.Resource {
StateContext: schema.ImportStatePassthroughContext,
},

Schema: projectSchema,
Schema: projectSchema,
Description: "Provides an Artifactory project resource. This can be used to create and manage Artifactory project, maintain users/groups/roles/repos.\n\n## Repository Configuration\n\nAfter the project configuration is applied, the repository's attributes `project_key` and `project_environments` would be updated with the project's data. This will generate a state drift in the next Terraform plan/apply for the repository resource. To avoid this, apply `lifecycle.ignore_changes`:\n```hcl\nresource \"artifactory_local_maven_repository\" \"my_maven_releases\" {\n\tkey = \"my-maven-releases\"\n\t...\n\n\tlifecycle {\n\t\tignore_changes = [\n\t\t\tproject_environments,\n\t\t\tproject_key\n\t\t]\n\t}\n}\n```\n~>We strongly recommend using the `repos` attribute to manage the list of repositories. See below for additional details.",
}
}
4 changes: 2 additions & 2 deletions pkg/project/resource_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func makeInvalidProjectKeyTestCase(invalidProjectKey string, t *testing.T) (*tes
Steps: []resource.TestStep{
{
Config: project,
ExpectError: regexp.MustCompile(".*project_key must be 3 - 10 lowercase alphanumeric and hyphen characters.*"),
ExpectError: regexp.MustCompile(".*project_key must be 2 - 10 lowercase alphanumeric and hyphen characters.*"),
},
},
}
Expand All @@ -77,7 +77,7 @@ func TestAccProjectInvalidProjectKey(t *testing.T) {
invalidProjectKeys := []testCase{
{
Name: "TooShort",
Value: strings.ToLower(randSeq(2)),
Value: strings.ToLower(randSeq(1)),
},
{
Name: "TooLong",
Expand Down

0 comments on commit 58e1c62

Please sign in to comment.