Allow managing members in the project resource (#480)

* Extend resource and datasource

* Adapt acc test to work without members

* Extend acc test and adjust resource

* Generate docs

* Fix lint

* Fix unit test

* Uniformize description with datasource and extend unit test

* Improve role field description

* Update TF state before adding/removing members

* Remove unused function

* Move intermediate map top state to mapProjectFields

* Improve code
This commit is contained in:
João Palet 2024-07-29 09:57:06 +01:00 committed by GitHub
parent af7d789945
commit 31ce9ab36d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1195 additions and 169 deletions

View file

@ -25,11 +25,23 @@ data "stackit_resourcemanager_project" "example" {
### Optional
- `container_id` (String) Project container ID. Globally unique, user-friendly identifier.
- `owner_email` (String, Deprecated) Email address of the owner of the project. This value is only considered during creation. Changing it afterwards will have no effect.
!> The "owner_email" field has been deprecated in favor of the "members" field. Please use the "members" field to assign the owner role to a user, by setting the "role" field to `owner`.
- `project_id` (String) Project UUID identifier. This is the ID that can be used in most of the other resources to identify the project.
### Read-Only
- `id` (String) Terraform's internal data source. ID. It is structured as "`container_id`".
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container. A label key must match the regex [A-ZÄÜÖa-zäüöß0-9_-]{1,64}. A label value must match the regex ^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}
- `members` (Attributes List) The members assigned to the project. At least one subject needs to be a user, and not a client or service account. (see [below for nested schema](#nestedatt--members))
- `name` (String) Project name.
- `parent_container_id` (String) Parent resource identifier. Both container ID (user-friendly) and UUID are supported
<a id="nestedatt--members"></a>
### Nested Schema for `members`
Read-Only:
- `role` (String) The role of the member in the project. At least one user must have the `owner` role. Legacy roles (`project.admin`, `project.auditor`, `project.member`, `project.owner`) are not supported.
- `subject` (String) Unique identifier of the user, service account or client. This is usually the email address for users or service accounts, and the name in case of clients.

View file

@ -141,6 +141,7 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de
### Optional
- `argus_custom_endpoint` (String) Custom endpoint for the Argus service
- `authorization_custom_endpoint` (String) Custom endpoint for the Membership service
- `credentials_path` (String) Path of JSON from where the credentials are read. Takes precedence over the env var `STACKIT_CREDENTIALS_PATH`. Default value is `~/.stackit/credentials.json`.
- `dns_custom_endpoint` (String) Custom endpoint for the DNS service
- `enable_beta_resources` (Boolean) Enable beta resources. Default is false.

View file

@ -29,15 +29,26 @@ resource "stackit_resourcemanager_project" "example" {
### Required
- `name` (String) Project name.
- `owner_email` (String) Email address of the owner of the project. This value is only considered during creation. Changing it afterwards will have no effect.
- `parent_container_id` (String) Parent resource identifier. Both container ID (user-friendly) and UUID are supported
### Optional
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container. A label key must match the regex [A-ZÄÜÖa-zäüöß0-9_-]{1,64}. A label value must match the regex ^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}
- `members` (Attributes List) The members assigned to the project. At least one subject needs to be a user, and not a client or service account. (see [below for nested schema](#nestedatt--members))
- `owner_email` (String, Deprecated) Email address of the owner of the project. This value is only considered during creation. Changing it afterwards will have no effect.
!> The "owner_email" field has been deprecated in favor of the "members" field. Please use the "members" field to assign the owner role to a user, by setting the "role" field to `owner`.
### Read-Only
- `container_id` (String) Project container ID. Globally unique, user-friendly identifier.
- `id` (String) Terraform's internal resource ID. It is structured as "`container_id`".
- `project_id` (String) Project UUID identifier. This is the ID that can be used in most of the other resources to identify the project.
<a id="nestedatt--members"></a>
### Nested Schema for `members`
Required:
- `role` (String) The role of the member in the project. At least one user must have the `owner` role. Legacy roles (`project.admin`, `project.auditor`, `project.member`, `project.owner`) are not supported.
- `subject` (String) Unique identifier of the user, service account or client. This is usually the email address for users or service accounts, and the name in case of clients.