From 4bea2c90c82b27635790b4e910ac9e18d0925c98 Mon Sep 17 00:00:00 2001 From: Stacey Salamon <111294980+staceysalamon-aiven@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:03:53 +0100 Subject: [PATCH] docs: add teams deprecation info to relevant resources (#1601) --- docs/resources/account_team.md | 22 +++++------ docs/resources/account_team_member.md | 38 ++++++++----------- docs/resources/account_team_project.md | 38 +++++++++---------- .../resources/aiven_account_team/resource.tf | 6 +-- .../aiven_account_team_member/resource.tf | 6 +-- .../aiven_account_team_project/resource.tf | 17 ++++++--- .../service/account/account_team.go | 9 ++--- .../service/account/account_team_member.go | 12 +++--- .../service/account/account_team_project.go | 9 ++--- templates/resources/account_team.md.tmpl | 25 ++++++++++++ .../resources/account_team_member.md.tmpl | 25 ++++++++++++ .../resources/account_team_project.md.tmpl | 25 ++++++++++++ 12 files changed, 148 insertions(+), 84 deletions(-) create mode 100644 templates/resources/account_team.md.tmpl create mode 100644 templates/resources/account_team_member.md.tmpl create mode 100644 templates/resources/account_team_project.md.tmpl diff --git a/docs/resources/account_team.md b/docs/resources/account_team.md index fcdce5b9d..150c065b8 100644 --- a/docs/resources/account_team.md +++ b/docs/resources/account_team.md @@ -1,24 +1,25 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "aiven_account_team Resource - terraform-provider-aiven" subcategory: "" description: |- - The Account Team resource allows the creation and management of an Account Team. + Creates and manages a team. --- - # aiven_account_team (Resource) +Creates and manages a team. -The Account Team resource allows the creation and management of an Account Team. +~> **Teams are becoming groups** +Groups are an easier way to control access to your organization's projects and +services for a group of users. +[Migrate your teams](https://aiven.io/docs/tools/terraform/howto/migrate-from-teams-to-groups) to groups. -## Example Usage +## Example Usage ```terraform -resource "aiven_account_team" "account_team1" { - account_id = aiven_account..account_id - name = "" +resource "aiven_account_team" "example_team" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + name = "Example team" } ``` - ## Schema @@ -48,11 +49,8 @@ Optional: - `delete` (String) - `read` (String) - `update` (String) - ## Import - Import is supported using the following syntax: - ```shell terraform import aiven_account_team.account_team1 account_id/team_id ``` diff --git a/docs/resources/account_team_member.md b/docs/resources/account_team_member.md index 3cebe349c..5d2c56ef9 100644 --- a/docs/resources/account_team_member.md +++ b/docs/resources/account_team_member.md @@ -1,36 +1,33 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "aiven_account_team_member Resource - terraform-provider-aiven" subcategory: "" description: |- - The Account Team Member resource allows the creation and management of an Aiven Account Team Member. - During the creation of aiven_account_team_memberresource, an email invitation will be sent - to a user using user_email address. If the user accepts an invitation, he or she will become - a member of the account team. The deletion of aiven_account_team_member will not only - delete the invitation if one was sent but not yet accepted by the user, it will also - eliminate an account team member if one has accepted an invitation previously. + Adds a user as a team member. + During the creation of this resource, an invite is sent to the address specified in user_email. + The user is added to the team after they accept the invite. Deleting aiven_account_team_member + deletes the pending invite if not accepted or removes the user from the team if they already accepted the invite. --- - # aiven_account_team_member (Resource) +Adds a user as a team member. -The Account Team Member resource allows the creation and management of an Aiven Account Team Member. +During the creation of this resource, an invite is sent to the address specified in `user_email`. +The user is added to the team after they accept the invite. Deleting `aiven_account_team_member` +deletes the pending invite if not accepted or removes the user from the team if they already accepted the invite. -During the creation of `aiven_account_team_member`resource, an email invitation will be sent -to a user using `user_email` address. If the user accepts an invitation, he or she will become -a member of the account team. The deletion of `aiven_account_team_member` will not only -delete the invitation if one was sent but not yet accepted by the user, it will also -eliminate an account team member if one has accepted an invitation previously. +~> **Teams are becoming groups** +Groups are an easier way to control access to your organization's projects and +services for a group of users. +[Migrate your teams](https://aiven.io/docs/tools/terraform/howto/migrate-from-teams-to-groups) to groups. -## Example Usage +## Example Usage ```terraform -resource "aiven_account_team_member" "foo" { - account_id = aiven_account..account_id - team_id = aiven_account_team..team_id +resource "aiven_account_team_member" "main" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + team_id = aiven_account_team.TEAM_RESOURCE_NAME.team_id user_email = "user+1@example.com" } ``` - ## Schema @@ -61,11 +58,8 @@ Optional: - `delete` (String) - `read` (String) - `update` (String) - ## Import - Import is supported using the following syntax: - ```shell terraform import aiven_account_team_member.foo account_id/team_id/user_email ``` diff --git a/docs/resources/account_team_project.md b/docs/resources/account_team_project.md index ce14a2570..342824835 100644 --- a/docs/resources/account_team_project.md +++ b/docs/resources/account_team_project.md @@ -1,38 +1,37 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "aiven_account_team_project Resource - terraform-provider-aiven" subcategory: "" description: |- - The Account Team Project resource allows the creation and management of an Account Team Project. - It is intended to link an existing project to the existing account team. - It is important to note that the project should have an account_id property set equal to the - account team you are trying to link to this project. + Links an existing project to an existing team. Both the project and team should have the same account_id. --- - # aiven_account_team_project (Resource) +Links an existing project to an existing team. Both the project and team should have the same `account_id`. -The Account Team Project resource allows the creation and management of an Account Team Project. +~> **Teams are becoming groups** +Groups are an easier way to control access to your organization's projects and +services for a group of users. +[Migrate your teams](https://aiven.io/docs/tools/terraform/howto/migrate-from-teams-to-groups) to groups. -It is intended to link an existing project to the existing account team. -It is important to note that the project should have an `account_id` property set equal to the -account team you are trying to link to this project. ## Example Usage - ```terraform -resource "aiven_project" "" { +resource "aiven_project" "example_project" { project = "project-1" - account_id = aiven_account_team..account_id + account_id = aiven_account_team.ACCOUNT_RESOURCE_NAME.account_id +} + +resource "aiven_account_team" "example_team" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + name = "Example team" } -resource "aiven_account_team_project" "account_team_project1" { - account_id = aiven_account..account_id - team_id = aiven_account_team..team_id - project_name = aiven_project..project +resource "aiven_account_team_project" "main" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + team_id = aiven_account_team.example_team.team_id + project_name = aiven_project.example_project.project team_type = "admin" } ``` - ## Schema @@ -61,11 +60,8 @@ Optional: - `delete` (String) - `read` (String) - `update` (String) - ## Import - Import is supported using the following syntax: - ```shell terraform import aiven_account_team_project.account_team_project1 account_id/team_id/project_name ``` diff --git a/examples/resources/aiven_account_team/resource.tf b/examples/resources/aiven_account_team/resource.tf index 105c179f2..9c7d4c8a2 100644 --- a/examples/resources/aiven_account_team/resource.tf +++ b/examples/resources/aiven_account_team/resource.tf @@ -1,4 +1,4 @@ -resource "aiven_account_team" "account_team1" { - account_id = aiven_account..account_id - name = "" +resource "aiven_account_team" "example_team" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + name = "Example team" } diff --git a/examples/resources/aiven_account_team_member/resource.tf b/examples/resources/aiven_account_team_member/resource.tf index 38162aaaf..b7a1b59a6 100644 --- a/examples/resources/aiven_account_team_member/resource.tf +++ b/examples/resources/aiven_account_team_member/resource.tf @@ -1,5 +1,5 @@ -resource "aiven_account_team_member" "foo" { - account_id = aiven_account..account_id - team_id = aiven_account_team..team_id +resource "aiven_account_team_member" "main" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + team_id = aiven_account_team.TEAM_RESOURCE_NAME.team_id user_email = "user+1@example.com" } diff --git a/examples/resources/aiven_account_team_project/resource.tf b/examples/resources/aiven_account_team_project/resource.tf index 97a6607ac..752cccea0 100644 --- a/examples/resources/aiven_account_team_project/resource.tf +++ b/examples/resources/aiven_account_team_project/resource.tf @@ -1,11 +1,16 @@ -resource "aiven_project" "" { +resource "aiven_project" "example_project" { project = "project-1" - account_id = aiven_account_team..account_id + account_id = aiven_account_team.ACCOUNT_RESOURCE_NAME.account_id } -resource "aiven_account_team_project" "account_team_project1" { - account_id = aiven_account..account_id - team_id = aiven_account_team..team_id - project_name = aiven_project..project +resource "aiven_account_team" "example_team" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + name = "Example team" +} + +resource "aiven_account_team_project" "main" { + account_id = aiven_account.ACCOUNT_RESOURCE_NAME.account_id + team_id = aiven_account_team.example_team.team_id + project_name = aiven_project.example_project.project team_type = "admin" } diff --git a/internal/sdkprovider/service/account/account_team.go b/internal/sdkprovider/service/account/account_team.go index acf6ebcab..495cea6ae 100644 --- a/internal/sdkprovider/service/account/account_team.go +++ b/internal/sdkprovider/service/account/account_team.go @@ -4,11 +4,10 @@ import ( "context" "github.com/aiven/aiven-go-client/v2" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/aiven/terraform-provider-aiven/internal/common" "github.com/aiven/terraform-provider-aiven/internal/schemautil" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) var aivenAccountTeamSchema = map[string]*schema.Schema{ @@ -41,7 +40,7 @@ var aivenAccountTeamSchema = map[string]*schema.Schema{ func ResourceAccountTeam() *schema.Resource { return &schema.Resource{ - Description: "The Account Team resource allows the creation and management of an Account Team.", + Description: `Creates and manages a team.`, CreateContext: resourceAccountTeamCreate, ReadContext: resourceAccountTeamRead, UpdateContext: resourceAccountTeamUpdate, @@ -52,7 +51,7 @@ func ResourceAccountTeam() *schema.Resource { Timeouts: schemautil.DefaultResourceTimeouts(), Schema: aivenAccountTeamSchema, - DeprecationMessage: "This resource is deprecated", + DeprecationMessage: "This resource is deprecated. Use aiven_organization_user_group instead.", } } diff --git a/internal/sdkprovider/service/account/account_team_member.go b/internal/sdkprovider/service/account/account_team_member.go index 2441c89d9..63ffdd237 100644 --- a/internal/sdkprovider/service/account/account_team_member.go +++ b/internal/sdkprovider/service/account/account_team_member.go @@ -56,13 +56,11 @@ var aivenAccountTeamMemberSchema = map[string]*schema.Schema{ func ResourceAccountTeamMember() *schema.Resource { return &schema.Resource{ Description: ` -The Account Team Member resource allows the creation and management of an Aiven Account Team Member. +Adds a user as a team member. -During the creation of ` + "`aiven_account_team_member`" + `resource, an email invitation will be sent -to a user using ` + "`user_email`" + ` address. If the user accepts an invitation, he or she will become -a member of the account team. The deletion of ` + "`aiven_account_team_member`" + ` will not only -delete the invitation if one was sent but not yet accepted by the user, it will also -eliminate an account team member if one has accepted an invitation previously. +During the creation of this resource, an invite is sent to the address specified in ` + "`user_email`" + `. +The user is added to the team after they accept the invite. Deleting ` + "`aiven_account_team_member`" + ` +deletes the pending invite if not accepted or removes the user from the team if they already accepted the invite. `, CreateContext: resourceAccountTeamMemberCreate, ReadContext: resourceAccountTeamMemberRead, @@ -73,7 +71,7 @@ eliminate an account team member if one has accepted an invitation previously. Timeouts: schemautil.DefaultResourceTimeouts(), Schema: aivenAccountTeamMemberSchema, - DeprecationMessage: "This resource is deprecated", + DeprecationMessage: "This resource is deprecated. Use aiven_organization_user_group_member instead.", } } diff --git a/internal/sdkprovider/service/account/account_team_project.go b/internal/sdkprovider/service/account/account_team_project.go index 48969bdcf..026687617 100644 --- a/internal/sdkprovider/service/account/account_team_project.go +++ b/internal/sdkprovider/service/account/account_team_project.go @@ -40,11 +40,7 @@ var aivenAccountTeamProjectSchema = map[string]*schema.Schema{ func ResourceAccountTeamProject() *schema.Resource { return &schema.Resource{ Description: ` -The Account Team Project resource allows the creation and management of an Account Team Project. - -It is intended to link an existing project to the existing account team. -It is important to note that the project should have an ` + "`account_id`" + ` property set equal to the -account team you are trying to link to this project. +Links an existing project to an existing team. Both the project and team should have the same ` + "`account_id`" + `. `, CreateContext: resourceAccountTeamProjectCreate, ReadContext: resourceAccountTeamProjectRead, @@ -56,6 +52,9 @@ account team you are trying to link to this project. Timeouts: schemautil.DefaultResourceTimeouts(), Schema: aivenAccountTeamProjectSchema, + DeprecationMessage: ` +This resource is deprecated. Use aiven_organization_group_project instead. +`, } } diff --git a/templates/resources/account_team.md.tmpl b/templates/resources/account_team.md.tmpl new file mode 100644 index 000000000..4effb7d7b --- /dev/null +++ b/templates/resources/account_team.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- +# {{.Name}} ({{.Type}}) +{{ .Description | trimspace }} + +~> **Teams are becoming groups** +Groups are an easier way to control access to your organization's projects and +services for a group of users. +[Migrate your teams](https://aiven.io/docs/tools/terraform/howto/migrate-from-teams-to-groups) to groups. + + +{{ if .HasExample -}} +## Example Usage +{{ tffile .ExampleFile }} +{{- end }} +{{ .SchemaMarkdown | trimspace }} +{{ if .HasImport -}} +## Import +Import is supported using the following syntax: +{{ codefile "shell" .ImportFile }} +{{- end }} diff --git a/templates/resources/account_team_member.md.tmpl b/templates/resources/account_team_member.md.tmpl new file mode 100644 index 000000000..4effb7d7b --- /dev/null +++ b/templates/resources/account_team_member.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- +# {{.Name}} ({{.Type}}) +{{ .Description | trimspace }} + +~> **Teams are becoming groups** +Groups are an easier way to control access to your organization's projects and +services for a group of users. +[Migrate your teams](https://aiven.io/docs/tools/terraform/howto/migrate-from-teams-to-groups) to groups. + + +{{ if .HasExample -}} +## Example Usage +{{ tffile .ExampleFile }} +{{- end }} +{{ .SchemaMarkdown | trimspace }} +{{ if .HasImport -}} +## Import +Import is supported using the following syntax: +{{ codefile "shell" .ImportFile }} +{{- end }} diff --git a/templates/resources/account_team_project.md.tmpl b/templates/resources/account_team_project.md.tmpl new file mode 100644 index 000000000..4effb7d7b --- /dev/null +++ b/templates/resources/account_team_project.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- +# {{.Name}} ({{.Type}}) +{{ .Description | trimspace }} + +~> **Teams are becoming groups** +Groups are an easier way to control access to your organization's projects and +services for a group of users. +[Migrate your teams](https://aiven.io/docs/tools/terraform/howto/migrate-from-teams-to-groups) to groups. + + +{{ if .HasExample -}} +## Example Usage +{{ tffile .ExampleFile }} +{{- end }} +{{ .SchemaMarkdown | trimspace }} +{{ if .HasImport -}} +## Import +Import is supported using the following syntax: +{{ codefile "shell" .ImportFile }} +{{- end }}