Skip to content
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

Update to latest terraform-plugin-docs module #183

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.9.2 (November 26, 2024). Tested on Artifactory 7.98.9 with Terraform 1.9.8 and OpenTofu 1.8.6

IMPROVEMENTS:

* provider: Update to latest `github.com/hashicorp/terraform-plugin-docs` module to restore auto-generation of documentation. PR: [#183](https://github.com/jfrog/terraform-provider-project/pull/183)

## 1.9.1 (November 20, 2024). Tested on Artifactory 7.98.8 with Terraform 1.9.8 and OpenTofu 1.8.5

BUG FIXES:
Expand Down
32 changes: 16 additions & 16 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ subcategory: ""
description: |-
Provides an Artifactory project resource. This can be used to create and manage Artifactory project, maintain users/groups/roles/repos.
Repository Configuration
After the project configuration is applied with `repos` attribute set, 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:
```hcl
resource "artifactorylocalmavenrepository" "mymaven_releases" {
key = "my-maven-releases"
...
lifecycle {
ignore_changes = [
project_environments,
project_key
]
}
After the project configuration is applied with repos attribute set, 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:

resource "artifactory_local_maven_repository" "my_maven_releases" {
key = "my-maven-releases"
...

lifecycle {
ignore_changes = [
project_environments,
project_key
]
}
}
```

~>We strongly recommend using the 'project_repository' resource instead to manage the list of repositories.

~>We strongly recommend using the project_repository resource instead to manage the list of repositories.
---

# project (Resource)
Expand All @@ -30,6 +29,7 @@ Provides an Artifactory project resource. This can be used to create and manage
## Repository Configuration

After the project configuration is applied with `repos` attribute set, 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`:

```hcl
resource "artifactory_local_maven_repository" "my_maven_releases" {
key = "my-maven-releases"
Expand All @@ -44,7 +44,7 @@ resource "artifactory_local_maven_repository" "my_maven_releases" {
}
```

~>We strongly recommend using the 'project_repository' resource instead to manage the list of repositories.
~>We strongly recommend using the `project_repository` resource instead to manage the list of repositories.

## Example Usage

Expand All @@ -69,12 +69,12 @@ resource "project" "myproject" {

### Required

- `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 2 - 32 lowercase alphanumeric and hyphen characters. Must begin with a letter. For example: `us1a-test`.

### Optional

- `admin_privileges` (Block Set) (see [below for nested schema](#nestedblock--admin_privileges))
- `block_deployments_on_limit` (Boolean) Block deployment of artifacts if storage quota is exceeded.

~>This setting only applies to self-hosted environment. See [Manage Storage Quotas](https://jfrog.com/help/r/jfrog-platform-administration-documentation/manage-storage-quotas).
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.22.7

require (
github.com/go-resty/resty/v2 v2.16.2
github.com/hashicorp/terraform-plugin-docs v0.20.0
github.com/hashicorp/terraform-plugin-docs v0.20.1
github.com/hashicorp/terraform-plugin-framework v1.13.0
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0
github.com/hashicorp/terraform-plugin-log v0.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVW
github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg=
github.com/hashicorp/terraform-json v0.23.0 h1:sniCkExU4iKtTADReHzACkk8fnpQXrdD2xoR+lppBkI=
github.com/hashicorp/terraform-json v0.23.0/go.mod h1:MHdXbBAbSg0GvzuWazEGKAn/cyNfIB7mN6y7KJN6y2c=
github.com/hashicorp/terraform-plugin-docs v0.20.0 h1:ox7rm1FN0dVZaJBUzkVVh10R1r3+FeMQWL0QopQ9d7o=
github.com/hashicorp/terraform-plugin-docs v0.20.0/go.mod h1:A/+4SVMdAkQYtIBtaxV0H7AU862TxVZk/hhKaMDQB6Y=
github.com/hashicorp/terraform-plugin-docs v0.20.1 h1:Fq7E/HrU8kuZu3hNliZGwloFWSYfWEOWnylFhYQIoys=
github.com/hashicorp/terraform-plugin-docs v0.20.1/go.mod h1:Yz6HoK7/EgzSrHPB9J/lWFzwl9/xep2OPnc5jaJDV90=
github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw=
github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU=
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0 h1:RXMmu7JgpFjnI1a5QjMCBb11usrW2OtAG+iOTIj5c9Y=
Expand Down
9 changes: 6 additions & 3 deletions pkg/project/resource/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ var schemaV1 = schema.Schema{
Optional: true,
},
"type": schema.StringAttribute{
Optional: true,
Required: true,
Validators: []validator.String{
stringvalidator.RegexMatches(customRoleTypeRegex, fmt.Sprintf(`Only "%s" is supported`, customRoleType)),
},
Expand Down Expand Up @@ -586,7 +586,7 @@ var schemaV2 = schema.Schema{
Optional: true,
},
"type": schema.StringAttribute{
Optional: true,
Required: true,
Validators: []validator.String{
stringvalidator.RegexMatches(customRoleTypeRegex, fmt.Sprintf(`Only "%s" is supported`, customRoleType)),
},
Expand All @@ -608,6 +608,7 @@ var schemaV2 = schema.Schema{
DeprecationMessage: "Replaced by `project_role` resource. This should not be used in combination with `project_role` resource. Use `use_project_role_resource` attribute to control which resource manages project roles.",
},
}),
Description: schemaV1.Description,
}

var schemaV3 = schema.Schema{
Expand Down Expand Up @@ -668,6 +669,7 @@ var schemaV3 = schema.Schema{
DeprecationMessage: "Replaced by `project_group` resource. This should not be used in combination with `project_group` resource. Use `use_project_group_resource` attribute to control which resource manages project roles.",
},
}),
Description: schemaV2.Description,
}

func (r *ProjectResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
Expand All @@ -690,7 +692,8 @@ func (r *ProjectResource) Schema(ctx context.Context, req resource.SchemaRequest
DeprecationMessage: "Replaced by `project_repository` resource. This should not be used in combination with `project_repository` resource. Use `use_project_repository_resource` attribute to control which resource manages project repositories.",
},
}),
Blocks: schemaV3.Blocks,
Blocks: schemaV3.Blocks,
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 with `repos` attribute set, 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\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\n~>We strongly recommend using the `project_repository` resource instead to manage the list of repositories.",
}
}

Expand Down