-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Terraform] clarify docs around service account id #1054
Merged
modular-magician
merged 2 commits into
GoogleCloudPlatform:master
from
danawillow:tf-2180-service-acct-docs
Dec 14, 2018
Merged
Changes from all commits
Commits
Show all changes
2 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
Submodule terraform
updated
from aeeb3d to f38ffb
Submodule terraform-beta
updated
from 083265 to ba44a7
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ description: |- | |
|
||
# IAM policy for service account | ||
|
||
When managing IAM roles, you can treat a service account either as a resource or as an identity. This resource is to add iam policy bindings to a service account resource to configure permissions for who can edit the service account. To configure permissions for a service account to act as an identity that can manage other GCP resources, use the [google_project_iam](google_project_iam.html) set of resources. | ||
When managing IAM roles, you can treat a service account either as a resource or as an identity. This resource is to add iam policy bindings to a service account resource **to configure permissions for who can edit the service account**. To configure permissions for a service account to act as an identity that can manage other GCP resources, use the [google_project_iam](google_project_iam.html) set of resources. | ||
|
||
Three different resources help you manage your IAM policy for a service account. Each of these resources serves a different use case: | ||
|
||
|
@@ -25,26 +25,37 @@ Three different resources help you manage your IAM policy for a service account. | |
```hcl | ||
data "google_iam_policy" "admin" { | ||
binding { | ||
role = "roles/editor" | ||
role = "roles/iam.serviceAccountUser" | ||
|
||
members = [ | ||
"user:[email protected]", | ||
] | ||
} | ||
} | ||
|
||
resource "google_service_account" "sa" { | ||
account_id = "my-service-account" | ||
display_name = "A service account that only Jane can interact with" | ||
} | ||
|
||
resource "google_service_account_iam_policy" "admin-account-iam" { | ||
service_account_id = "your-service-account-id" | ||
service_account_id = "${google_service_account.sa.name}" | ||
policy_data = "${data.google_iam_policy.admin.policy_data}" | ||
} | ||
``` | ||
|
||
## google\_service\_account\_iam\_binding | ||
|
||
```hcl | ||
|
||
resource "google_service_account" "sa" { | ||
account_id = "my-service-account" | ||
display_name = "A service account that only Jane can use" | ||
} | ||
|
||
resource "google_service_account_iam_binding" "admin-account-iam" { | ||
service_account_id = "your-service-account-id" | ||
role = "roles/editor" | ||
service_account_id = "${google_service_account.sa.name}" | ||
role = "roles/iam.serviceAccountUser" | ||
|
||
members = [ | ||
"user:[email protected]", | ||
|
@@ -55,18 +66,23 @@ resource "google_service_account_iam_binding" "admin-account-iam" { | |
## google\_service\_account\_iam\_member | ||
|
||
```hcl | ||
resource "google_service_account" "sa" { | ||
account_id = "my-service-account" | ||
display_name = "A service account that Jane can use" | ||
} | ||
|
||
resource "google_service_account_iam_member" "admin-account-iam" { | ||
service_account_id = "your-service-account-id" | ||
role = "roles/editor" | ||
member = "user:[email protected]" | ||
service_account_id = "${google_service_account.sa.name}" | ||
role = "roles/iam.serviceAccountUser" | ||
member = "user:[email protected]" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `service_account_id` - (Required) The service account id to apply policy to. | ||
* `service_account_id` - (Required) The fully-qualified name of the service account to apply policy to. | ||
|
||
* `member/members` - (Required) Identities that will be granted the privilege in `role`. | ||
Each entry can have one of the following values: | ||
|
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.
🤦♀️ did we not have accounts in the examples yet