From 52b59aa172887ecde99f8da5ba979ffc70eb2c54 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Tue, 26 Nov 2024 09:18:04 -0800 Subject: [PATCH] Update to latest terraform-plugin-docs` module To restore auto-generation of documentation --- docs/resources/project.md | 32 ++++++++++++------------ go.mod | 2 +- go.sum | 4 +-- pkg/project/resource/resource_project.go | 9 ++++--- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/docs/resources/project.md b/docs/resources/project.md index 90f19b4d..cd7fc4e9 100644 --- a/docs/resources/project.md +++ b/docs/resources/project.md @@ -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) @@ -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" @@ -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 @@ -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). diff --git a/go.mod b/go.mod index 5a535f27..8a5486f9 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 3a4cef96..c567aec3 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/project/resource/resource_project.go b/pkg/project/resource/resource_project.go index aa919224..08e5ac94 100644 --- a/pkg/project/resource/resource_project.go +++ b/pkg/project/resource/resource_project.go @@ -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)), }, @@ -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)), }, @@ -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{ @@ -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) { @@ -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.", } }