Skip to content
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

Add warnings about custom role format for IAM bindings #5335

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions google/resource_iam_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func resourceIamBindingRead(newUpdaterFunc newResourceIamUpdaterFunc) schema.Rea
}

if binding == nil {
log.Printf("[WARNING] Binding for role %q not found, assuming it has no members. If you expected existing members bound for this role, make sure your role is correctly formatted.", eBinding.Role)
log.Printf("[DEBUG] Binding for role %q and condition %+v not found in policy for %s, assuming it has no members.", eBinding.Role, eCondition, updater.DescribeResource())
d.Set("role", eBinding.Role)
d.Set("members", nil)
Expand Down
1 change: 1 addition & 0 deletions google/resource_sql_database_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"

sqladmin "google.golang.org/api/sqladmin/v1beta4"
)

Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/bigtable_instance_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ $ terraform import google_bigtable_instance_iam_binding.editor "projects/{projec

$ terraform import google_bigtable_instance_iam_member.editor "projects/{project}/instances/{instance} roles/editor user:jane@example.com"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
emilymye marked this conversation as resolved.
Show resolved Hide resolved
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ $ terraform import google_binary_authorization_attestor_iam_policy.editor projec
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/cloud_run_service_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ $ terraform import google_cloud_run_service_iam_policy.editor projects/{{project
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ $ terraform import google_cloudfunctions_function_iam_policy.editor projects/{{p
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/compute_instance_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ $ terraform import google_compute_instance_iam_policy.editor projects/{{project}
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/compute_subnetwork_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ $ terraform import google_compute_subnetwork_iam_policy.editor projects/{{projec
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/dataproc_cluster_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ $ terraform import google_dataproc_cluster_iam_binding.editor "projects/{project

$ terraform import google_dataproc_cluster_iam_member.editor "projects/{project}/regions/{region}/clusters/{cluster} roles/editor user:jane@example.com"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/dataproc_job_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ $ terraform import google_dataproc_job_iam_binding.editor "projects/{project}/re

$ terraform import google_dataproc_job_iam_member.editor "projects/{project}/regions/{region}/jobs/{job_id} roles/editor user:jane@example.com"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ IAM member imports use space-delimited identifiers; the resource in question, th
```
$ terraform import google_billing_account_iam_member.binding "your-billing-account-id roles/viewer user:foo@example.com"
```

-> **Custom Roles**: If you're importing a IAM member with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/google_folder_iam_binding.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ IAM binding imports use space-delimited identifiers; first the resource in quest
```
$ terraform import google_folder_iam_binding.viewer "folder-name roles/viewer"
```

-> **Custom Roles**: If you're importing a IAM binding with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/google_folder_iam_member.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ IAM member imports use space-delimited identifiers; the resource in question, th
```
$ terraform import google_folder_iam_member.my_project "folder-name roles/viewer user:foo@example.com"
```

-> **Custom Roles**: If you're importing a IAM member with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/google_organization_iam_binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ IAM binding imports use space-delimited identifiers; first the resource in quest
```
$ terraform import google_organization_iam_binding.my_org "your-org-id roles/viewer"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/google_organization_iam_member.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ IAM member imports use space-delimited identifiers; the resource in question, th
```
$ terraform import google_organization_iam_member.my_org "your-org-id roles/viewer user:foo@example.com"
```

-> **Custom Roles**: If you're importing a IAM member with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
4 changes: 4 additions & 0 deletions website/docs/r/google_project_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,7 @@ IAM audit config imports use the identifier of the resource in question and the
```
terraform import google_project_iam_audit_config.my_project "your-project-id foo.googleapis.com"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

3 changes: 3 additions & 0 deletions website/docs/r/google_service_account_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ $ terraform import google_service_account_iam_binding.admin-account-iam "project
$ terraform import google_service_account_iam_member.admin-account-iam "projects/{your-project-id}/serviceAccounts/{your-service-account-email} roles/editor user:foo@example.com"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

With conditions:
```
$ terraform import -provider=google-beta google_service_account_iam_binding.admin-account-iam "projects/{your-project-id}/serviceAccounts/{your-service-account-email} iam.serviceAccountUser expires_after_2019_12_31"
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/healthcare_dataset_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,6 @@ IAM policy imports use the identifier of the resource in question. This policy
```
$ terraform import google_healthcare_dataset_iam_policy.dataset_iam your-project-id/location-name/dataset-name
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/iap_app_engine_service_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ $ terraform import google_iap_app_engine_service_iam_policy.editor projects/{{pr
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/iap_app_engine_version_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ $ terraform import google_iap_app_engine_version_iam_policy.editor projects/{{pr
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/iap_web_backend_service_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ $ terraform import google_iap_web_backend_service_iam_policy.editor projects/{{p
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/iap_web_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ $ terraform import google_iap_web_iam_policy.editor projects/{{project}}/iap_web
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/iap_web_type_app_engine_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ $ terraform import google_iap_web_type_app_engine_iam_policy.editor projects/{{p
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/iap_web_type_compute_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ $ terraform import google_iap_web_type_compute_iam_policy.editor projects/{{proj
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/pubsub_subscription_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ $ terraform import google_pubsub_subscription_iam_binding.editor "projects/{your

$ terraform import google_pubsub_subscription_iam_member.editor "projects/{your-project-id}/subscriptions/{your-subscription-name} roles/editor jane@example.com"
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/pubsub_topic_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ $ terraform import google_pubsub_topic_iam_policy.editor projects/{{project}}/to
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/runtimeconfig_config_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ $ terraform import google_runtimeconfig_config_iam_policy.editor projects/{{proj
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
3 changes: 3 additions & 0 deletions website/docs/r/sourcerepo_repository_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ $ terraform import google_sourcerepo_repository_iam_policy.editor projects/{{pro
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).
4 changes: 4 additions & 0 deletions website/docs/r/spanner_database_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,7 @@ IAM policy imports use the identifier of the resource in question, e.g.
```
$ terraform import google_spanner_database_iam_policy.database project-name/instance-name/database-name
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

3 changes: 3 additions & 0 deletions website/docs/r/spanner_instance_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ IAM policy imports use the identifier of the resource in question, e.g.
```
$ terraform import google_spanner_instance_iam_policy.instance project-name/instance-name
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
3 changes: 3 additions & 0 deletions website/docs/r/storage_bucket_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ $ terraform import google_storage_bucket_iam_policy.editor b/{{bucket}}
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
as an argument so that Terraform uses the correct provider to import your resource.

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

## User Project Overrides

This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#user_project_override).