-
Notifications
You must be signed in to change notification settings - Fork 210
doc: Migration guide to move from API Keys (PAKs) to Service Accounts #4047
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
base: CLOUDP-352932-service-accounts-dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,186 @@ | ||||||
| --- | ||||||
| page_title: "Migration Guide: Programmatic API Keys (PAKs) to Service Accounts (SAs)" | ||||||
| --- | ||||||
|
|
||||||
| **Note:** Migration to Service Accounts is **not required**. If you are currently using `mongodbatlas_api_key`, `mongodbatlas_api_key_project_assignment`, and `mongodbatlas_access_list_api_key` resources, you may continue to do so. This guide is for users who wish to adopt Service Accounts for greater security, flexibility, or best practices, but existing PAK configurations will continue to work and are supported. | ||||||
|
|
||||||
| # Migration Guide: Programmatic API Keys (PAKs) to Service Accounts (SAs) | ||||||
|
|
||||||
| The goal of this guide is to help users transition from Programmatic API Keys (PAKs) to Service Accounts (SAs) in MongoDB Atlas. Service Accounts provide a more secure and flexible authentication method that eliminates the need to manage API key secrets in Terraform state. | ||||||
|
||||||
|
|
||||||
| ### Jump to: | ||||||
| - [Stage 1: Initial State (PAK Resources Only)](#stage-1-initial-state-pak-resources-only) | ||||||
| - [Stage 2: Intermediate State (Both PAK and SA Resources)](#stage-2-intermediate-state-both-pak-and-sa-resources) | ||||||
| - [Stage 3: Final State (SA Resources Only)](#stage-3-final-state-sa-resources-only) | ||||||
|
|
||||||
| ## Resource Mapping | ||||||
|
|
||||||
| The following table shows the mapping between PAK resources and their Service Account equivalents: | ||||||
|
|
||||||
| | PAK Resource | Service Account Resource | Notes | | ||||||
|
Collaborator
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. I think we should:
|
||||||
| |--------------|-------------------------|-------| | ||||||
| | `mongodbatlas_api_key` | `mongodbatlas_service_account` | Organization-level key/account | | ||||||
|
||||||
| | `mongodbatlas_api_key` | `mongodbatlas_service_account` | Organization-level key/account | | |
| | `mongodbatlas_api_key` | `mongodbatlas_service_account` | API key / Service Account | |
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.
I think we can avoid repeating "organization-level" so often. Should be clear since we are in the "Organization-Level API Keys to Service Accounts" section.
Changing the api key description to not say "for project access" may help.
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.
Maybe go with ORG_MEMBER here since we are assigning to project. (Also update other configs if agreed)
| role_names = ["ORG_READ_ONLY"] | |
| role_names = ["ORG_MEMBER"] |
Outdated
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.
Just for clarity, wouldn't mix GROUP_OWNER with other roles since owner already contains other roles. Maybe go with ["GROUP_READ_ONLY", "GROUP_DATA_ACCESS_READ_ONLY"].
Outdated
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.
Matching the alternative to avoid confusion (also in other occurrences)
| cidr_block = "192.168.1.0/24" | |
| cidr_block = "192.168.1.100/32" |
Outdated
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.
| In this stage, you'll add Service Account resources alongside your existing PAK resources. This allows both authentication methods to work simultaneously, enabling you to test Service Accounts before removing PAKs. | |
| In this stage, you will add Service Account resources alongside your existing PAK resources. This allows both authentication methods to work simultaneously, enabling you to test Service Accounts before removing PAKs. |
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.
Do we use (new) in other guides when adding resources?
Outdated
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.
- The output block should be added together with the service account before running
applyin step 4 - I think we can remove the datasources
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.
Not sure if flexibility is a pro of SAs vs PAKs.