-
Notifications
You must be signed in to change notification settings - Fork 205
doc: Adds example & documentation for new mongodbatlas_team_project_assignment resource #3581
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
Open
csanx
wants to merge
8
commits into
CLOUDP-320243-dev-2.0.0
Choose a base branch
from
CLOUDP-334646
base: CLOUDP-320243-dev-2.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+185
−1
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Data Source: mongodbatlas_team_project_assignment | ||
|
||
`mongodbatlas_team_project_assignment` provides a Team Project Assignment data source. The data source lets you retrieve a team assigned to a project. | ||
|
||
## Example Usages | ||
|
||
```terraform | ||
resource "mongodbatlas_team_project_assignment" "example" { | ||
project_id = var.project_id | ||
team_id = var.team_id | ||
role_names = ["GROUP_OWNER", "GROUP_DATA_ACCESS_ADMIN"] | ||
} | ||
|
||
data "mongodbatlas_team_project_assignment" "example_username" { | ||
project_id = mongodbatlas_team_project_assignment.example.project_id | ||
team_id = mongodbatlas_team_project_assignment.example.team_id | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listprojects) endpoint to retrieve all projects to which the authenticated user has access. | ||
|
||
**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups. | ||
- `team_id` (String) Unique 24-hexadecimal character string that identifies the team. | ||
|
||
### Read-Only | ||
|
||
- `role_names` (Set of String) One or more project-level roles assigned to the team. | ||
|
||
For more information see: [MongoDB Atlas API - Teams](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getprojectteam) Documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Resource: mongodbatlas_team_project_assignment | ||
|
||
`mongodbatlas_team_project_assignment` provides a Team Project Assignment resource. It lets you manage the association between a team and a project, enabling you to import, assign, remove, or update the team's membership. | ||
## Example Usages | ||
|
||
```terraform | ||
resource "mongodbatlas_team_project_assignment" "example" { | ||
project_id = var.project_id | ||
team_id = var.team_id | ||
role_names = ["GROUP_OWNER", "GROUP_DATA_ACCESS_ADMIN"] | ||
} | ||
|
||
data "mongodbatlas_team_project_assignment" "example_username" { | ||
project_id = mongodbatlas_team_project_assignment.example.project_id | ||
team_id = mongodbatlas_team_project_assignment.example.team_id | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `project_id` (String) Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listprojects) endpoint to retrieve all projects to which the authenticated user has access. | ||
|
||
**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups. | ||
- `role_names` (Set of String) One or more project-level roles assigned to the team. | ||
- `team_id` (String) Unique 24-hexadecimal character string that identifies the team. | ||
|
||
## Import | ||
|
||
Team Project Assignment resource can be imported using the Project ID & TeamID, in the format `PROJECT_ID/TEAM_ID`. | ||
|
||
``` | ||
$ terraform import mongodbatlas_team_project_assignment.test 9f3a7c2e54b8d1a0e6f4b3c2/a4d9f7b18e52c0fa36b7e9cd | ||
``` | ||
|
||
For more information see: [MongoDB Atlas API - Teams](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-addallteamstoproject) Documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Example: mongodbatlas_team_project_assignment | ||
|
||
This example demonstrates how to use the `mongodbatlas_team_project_assignment` resource to assign a team to an existing project with specified roles in MongoDB Atlas. | ||
|
||
## Usage | ||
|
||
```hcl | ||
provider "mongodbatlas" { | ||
public_key = var.public_key | ||
private_key = var.private_key | ||
} | ||
|
||
resource "mongodbatlas_team_project_assignment" "example" { | ||
project_id = var.project_id | ||
team_id = var.team_id | ||
role_names = ["GROUP_OWNER", "GROUP_DATA_ACCESS_ADMIN"] | ||
} | ||
|
||
data "mongodbatlas_team_project_assignment" "example_username" { | ||
project_id = var.project_id | ||
team_id = var.team_id | ||
} | ||
``` | ||
|
||
You must set the following variables: | ||
|
||
- `public_key`: Your MongoDB Atlas API public key. | ||
- `private_key`: Your MongoDB Atlas API private key. | ||
- `project_id`: The ID of the project to assign the team to. | ||
- `team_id`: The ID of the team to assign to the project. | ||
|
||
To learn more, see the [MongoDB Atlas API - Cloud Users](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-addallteamstoproject) Documentation. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resource "mongodbatlas_team_project_assignment" "example" { | ||
project_id = var.project_id | ||
team_id = var.team_id | ||
role_names = ["GROUP_OWNER", "GROUP_DATA_ACCESS_ADMIN"] | ||
} | ||
|
||
data "mongodbatlas_team_project_assignment" "example_username" { | ||
project_id = mongodbatlas_team_project_assignment.example.project_id | ||
team_id = mongodbatlas_team_project_assignment.example.team_id | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
output "assigned_team" { | ||
description = "Details of the assigned team" | ||
value = mongodbatlas_team_project_assignment.example | ||
} | ||
output "team_from_team_id" { | ||
description = "Project assignment details for the team retrieved by team_id" | ||
value = data.mongodbatlas_team_project_assignment.example_username | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
provider "mongodbatlas" { | ||
public_key = var.public_key | ||
private_key = var.private_key | ||
} |
19 changes: 19 additions & 0 deletions
19
examples/mongodbatlas_team_project_assignment/variables.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
variable "project_id" { | ||
description = "The MongoDB Atlas project ID" | ||
type = string | ||
} | ||
|
||
variable "team_id" { | ||
description = "The MongoDB Atlas team ID" | ||
type = string | ||
} | ||
|
||
variable "public_key" { | ||
description = "Atlas API public key" | ||
type = string | ||
} | ||
|
||
variable "private_key" { | ||
description = "Atlas API private key" | ||
type = string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add |
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
mongodbatlas = { | ||
source = "mongodb/mongodbatlas" | ||
version = "~> 1.38" | ||
} | ||
} | ||
required_version = ">= 1.0" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# {{.Type}}: {{.Name}} | ||
|
||
`{{.Name}}` provides a Team Project Assignment data source. The data source lets you retrieve a team assigned to a project. | ||
|
||
## Example Usages | ||
|
||
{{ tffile (printf "examples/%s/main.tf" .Name )}} | ||
|
||
{{ .SchemaMarkdown | trimspace }} | ||
|
||
For more information see: [MongoDB Atlas API - Teams](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getprojectteam) Documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# {{.Type}}: {{.Name}} | ||
|
||
`{{.Name}}` provides a Team Project Assignment resource. It lets you manage the association between a team and a project, enabling you to import, assign, remove, or update the team's membership. | ||
## Example Usages | ||
|
||
{{ tffile (printf "examples/%s/main.tf" .Name )}} | ||
|
||
{{ .SchemaMarkdown | trimspace }} | ||
|
||
## Import | ||
|
||
Team Project Assignment resource can be imported using the Project ID & TeamID, in the format `PROJECT_ID/TEAM_ID`. | ||
|
||
``` | ||
$ terraform import mongodbatlas_team_project_assignment.test 9f3a7c2e54b8d1a0e6f4b3c2/a4d9f7b18e52c0fa36b7e9cd | ||
``` | ||
|
||
For more information see: [MongoDB Atlas API - Teams](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-addallteamstoproject) Documentation. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Consider using
this
instead ofexample
(Applies to all files) https://www.terraform-best-practices.com/naming