-
Notifications
You must be signed in to change notification settings - Fork 168
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
fix: How do I create Organization API Key with Organization Billing Admin permission and Project Read Only for projects #1369
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
122af77
INTMDB-898: fixing
andreaangiolillo 301c978
Merge remote-tracking branch 'origin/master' into INTMDB-898_3
andreaangiolillo 28bdbfc
fixed bug
andreaangiolillo 65c49f2
added acceptance tests
andreaangiolillo 1be6d59
Updated doc
andreaangiolillo f2e0820
Update acceptance-tests.yml
andreaangiolillo 1bf555b
Update website/docs/r/project_api_key.html.markdown
andreaangiolillo 0a1ad79
Addressed PR comments
andreaangiolillo 038b90e
Merge remote-tracking branch 'origin/master' into INTMDB-898_3
andreaangiolillo b728902
Merge branch 'INTMDB-898_3' of github.com:mongodb/terraform-provider-…
andreaangiolillo 955f875
Addressed PR comments
andreaangiolillo 56774ae
Addressed PR comments
andreaangiolillo 1105890
Merge remote-tracking branch 'origin/master' into INTMDB-898_3
andreaangiolillo fec47fa
Addressed PR comments
andreaangiolillo 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -35,13 +35,43 @@ resource "mongodbatlas_project_api_key" "test" { | |
} | ||
|
||
project_assignment { | ||
project_id = "74259ee860c43338194b0f8e" | ||
project_id = "64229ee820c42228194b0f4a" | ||
role_names = ["GROUP_READ_ONLY"] | ||
} | ||
|
||
} | ||
``` | ||
|
||
## Example Usage - Create Org PAK and Assign it to Multiple Projects | ||
|
||
```terraform | ||
resource "mongodbatlas_project" "atlas-project" { | ||
name = "ProjectTest" | ||
org_id = "60ddf55c27a5a20955a707d7" | ||
} | ||
|
||
resource "mongodbatlas_project_api_key" "api_1" { | ||
description = "test api_key multi" | ||
project_id = mongodbatlas_project.atlas-project.id | ||
|
||
// NOTE: The `project_id` of the first `project_assignment` element must be the same as the `project_id` of the resource. | ||
project_assignment { | ||
andreaangiolillo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
project_id = mongodbatlas_project.atlas-project.id | ||
role_names = ["ORG_BILLING_ADMIN", "GROUP_READ_ONLY"] | ||
} | ||
|
||
project_assignment { | ||
project_id = "63dcfc256af00a5934e60924" | ||
role_names = ["GROUP_READ_ONLY"] | ||
} | ||
|
||
project_assignment { | ||
project_id = "64c23af6f133166c39176cbf" | ||
role_names = ["GROUP_OWNER"] | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
* `project_id` -Unique 24-hexadecimal digit string that identifies your project. | ||
|
@@ -56,6 +86,12 @@ List of Project roles that the Programmatic API key needs to have. `project_assi | |
* `project_id` - (Required) Project ID to assign to Access Key | ||
* `role_names` - (Required) List of Project roles that the Programmatic API key needs to have. Ensure you provide: at least one role and ensure all roles are valid for the Project. You must specify an array even if you are only associating a single role with the Programmatic API key. The [MongoDB Documentation](https://www.mongodb.com/docs/atlas/reference/user-roles/#project-roles) describes the valid roles that can be assigned. | ||
|
||
~> **NOTE:** The `project_id` of the first `project_assignment` element must be the same as the `project_id` of the resource. | ||
andreaangiolillo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
~> **NOTE:** The organization level roles can be defined only in the first `project_assignment` element. | ||
|
||
~> **NOTE:** The `ORG_READ_ONLY` role at the organization level is invalid in this context. When the `project_assignment``` lacks organizational roles, the `mongodbatlas_project_api_key` resource generates an organization API key with the `ORG_READ_ONLY` role and associates it with `GROUP_*` roles. Consequently, the resource does not permit the use of `ORG_READ_ONLY` to ensure consistency between configuration and state. | ||
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. FYI |
||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
Oops, something went wrong.
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.
validating that the user did not provide
ORG_READ_ONLY