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

feat: add iam submodule for tag keys and values #190

Merged
merged 7 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion examples/bigquery_dataset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This example illustrates how to use the `bigquery_datasets_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| bigquery\_dataset\_one | BQ dataset ID |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5 changes: 5 additions & 0 deletions examples/bigquery_dataset/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ resource "google_bigquery_dataset" "bigquery_dataset_one" {
resource "random_id" "test" {
byte_length = 4
}

output "bigquery_dataset_one" {
imrannayer marked this conversation as resolved.
Show resolved Hide resolved
value = google_bigquery_dataset.bigquery_dataset_one.dataset_id
description = "BQ dataset ID"
}
4 changes: 3 additions & 1 deletion examples/cloud_run_service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This example illustrates how to use the `cloud_run_service_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| cloud\_run\_service\_one | CloudRun Service |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/cloud_run_service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ module "cloud_run_service_iam_binding" {
}
}

output "cloud_run_service_one" {
value = var.cloud_run_service_one
description = "CloudRun Service"
}
4 changes: 3 additions & 1 deletion examples/dns_zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This example illustrates how to use the `bigquery_datasets_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| dns\_zone\_one | DNS Zone created |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5 changes: 5 additions & 0 deletions examples/dns_zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ resource "google_dns_managed_zone" "dns_zone_one" {
resource "random_id" "test" {
byte_length = 4
}

output "dns_zone_one" {
value = google_dns_managed_zone.dns_zone_one.name
description = "DNS Zone created"
}
3 changes: 0 additions & 3 deletions examples/dns_zone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ variable "user_email" {
description = "Email for group to receive roles (Ex. user@example.com)"
}

/******************************************
bigquery_dataset_iam_binding variables
*****************************************/
variable "project_id" {
type = string
description = "Project ID to create BigQuery resources in"
Expand Down
4 changes: 3 additions & 1 deletion examples/folder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ This example illustrates how to use the `folders_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| folder | folder one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

5 changes: 5 additions & 0 deletions examples/folder/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ module "folder-iam" {
]
}
}

output "folder" {
value = var.folder_one
description = "folder one"
}
4 changes: 3 additions & 1 deletion examples/kms_crypto_key/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This example illustrates how to use the `kms_crypto_keys_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| kms\_crypto\_one | KMS crypto one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/kms_crypto_key/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ module "kms_crypto_key_iam_binding" {
}
}

output "kms_crypto_one" {
value = var.kms_crypto_key_one
description = "KMS crypto one"
}
4 changes: 3 additions & 1 deletion examples/kms_key_ring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This example illustrates how to use the `kms_key_rings_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| kms\_key\_ring | kms key ring one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/kms_key_ring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ module "kms_key_ring_iam_binding" {
}
}

output "kms_key_ring" {
value = var.kms_key_ring_one
description = "kms key ring one"
}
4 changes: 3 additions & 1 deletion examples/organization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This example illustrates how to use the `organizations_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| organization | organization one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/organization/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ module "organization_iam_binding" {
}
}

output "organization" {
value = var.organization_one
description = "organization one"
}
4 changes: 3 additions & 1 deletion examples/project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This example illustrates how to use the `projects_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| project\_one | project one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ module "project_iam_binding" {
}
}

output "project_one" {
value = var.project_one
description = "project one"
}
4 changes: 3 additions & 1 deletion examples/project_conditions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This example illustrates how to use the `projects_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| project\_one | project one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/project_conditions/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ module "project_iam_binding" {
]
}

output "project_one" {
value = var.project_one
description = "project one"
}
4 changes: 3 additions & 1 deletion examples/pubsub_subscription/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ This example illustrates how to use the `pubsub_subscriptions_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| pubsub\_subscription\_one | subscription one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/pubsub_subscription/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ module "pubsub_subscription_iam_binding" {
}
}

output "pubsub_subscription_one" {
value = var.pubsub_subscription_one
description = "subscription one"
}
4 changes: 3 additions & 1 deletion examples/pubsub_topic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ This example illustrates how to use the `pubsub_topics_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| pubsub\_topic\_one | topic one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/pubsub_topic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ module "pubsub_topic_iam_binding" {
}
}

output "pubsub_topic_one" {
value = var.pubsub_topic_one
description = "topic one"
}
4 changes: 3 additions & 1 deletion examples/secret_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ This example illustrates how to use the `secret_manager_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| secret\_one | secret oneß |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

5 changes: 5 additions & 0 deletions examples/secret_manager/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ module "folder-iam" {
]
}
}

output "secret_one" {
value = var.secret_one
description = "secret oneß"
}
4 changes: 3 additions & 1 deletion examples/service_account/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ This example illustrates how to use the `service_accounts_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| service\_account\_one | service account one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

5 changes: 5 additions & 0 deletions examples/service_account/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ module "service_account_iam_binding" {
]
}
}

output "service_account_one" {
value = var.service_account_one
description = "service account one"
}
4 changes: 3 additions & 1 deletion examples/stackdriver_agent_roles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Applies the roles necessary to write metrics and logs to Stackdriver to a given

## Outputs

No output.
| Name | Description |
|------|-------------|
| project | project |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/stackdriver_agent_roles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ resource "google_project_iam_member" "monitoring-metric_writer" {
project = var.project
}

output "project" {
value = var.project
description = "project"
}
4 changes: 3 additions & 1 deletion examples/storage_bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This example illustrates how to use the `storage_buckets_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| storage\_bucket\_one | bucket one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions examples/storage_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ module "storage_buckets_iam_binding" {
}
}

output "storage_bucket_one" {
value = var.storage_bucket_one
description = "bucket one"
}
4 changes: 3 additions & 1 deletion examples/subnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ This example illustrates how to use the `subnets_iam` submodule

## Outputs

No output.
| Name | Description |
|------|-------------|
| subnet\_one | subnet one |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

Expand Down
4 changes: 4 additions & 0 deletions examples/subnet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ module "subnet_iam_binding" {
}
}

output "subnet_one" {
value = var.subnet_one
description = "subnet one"
}
21 changes: 21 additions & 0 deletions examples/tag_keys/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# DNS ZOne Example

This example illustrates how to use the `bigquery_datasets_iam` submodule

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| group\_email | Email for group to receive roles (ex. group@example.com) | `string` | n/a | yes |
| project\_id | Project ID to create BigQuery resources in | `string` | n/a | yes |
| sa\_email | Email for Service Account to receive roles (Ex. default-sa@example-project-id.iam.gserviceaccount.com) | `string` | n/a | yes |
| user\_email | Email for group to receive roles (Ex. user@example.com) | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| tag\_key | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
48 changes: 48 additions & 0 deletions examples/tag_keys/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*********************************************
Module tag_keys_iam_binding calling
*********************************************/
module "tag_keys_iam_binding" {
source = "../../modules/tag_keys_iam/"
tag_keys = [
google_tags_tag_key.tag_key.name,
]
mode = "authoritative"

bindings = {
"roles/viewer" = [
"serviceAccount:${var.sa_email}",
"group:${var.group_email}",
"user:${var.user_email}",
]
}
}

data "google_project" "project" {
project_id = var.project_id
}

resource "google_tags_tag_key" "tag_key" {
parent = "projects/${data.google_project.project.number}"
short_name = "foo"
description = "test tags"
}

output "tag_key" {
value = google_tags_tag_key.tag_key.short_name
}
Loading