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

Adding type constraints to variables #43

Merged
merged 3 commits into from
Mar 4, 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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Functional examples are included in the

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| admins | IAM-style members who will be granted roles/storage.objectAdmin on all buckets. | list | `<list>` | no |
| admins | IAM-style members who will be granted roles/storage.objectAdmin on all buckets. | list(string) | `<list>` | no |
| bucket\_admins | Map of lowercase unprefixed name => comma-delimited IAM-style bucket admins. | map | `<map>` | no |
| bucket\_creators | Map of lowercase unprefixed name => comma-delimited IAM-style bucket creators. | map | `<map>` | no |
| bucket\_policy\_only | Disable ad-hoc ACLs on specified buckets. Defaults to true. Map of lowercase unprefixed name => boolean | map | `<map>` | no |
| bucket\_viewers | Map of lowercase unprefixed name => comma-delimited IAM-style bucket viewers. | map | `<map>` | no |
| creators | IAM-style members who will be granted roles/storage.objectCreators on all buckets. | list | `<list>` | no |
| creators | IAM-style members who will be granted roles/storage.objectCreators on all buckets. | list(string) | `<list>` | no |
| encryption\_key\_names | Optional map of lowercase unprefixed name => string, empty strings are ignored. | map | `<map>` | no |
| force\_destroy | Optional map of lowercase unprefixed name => boolean, defaults to false. | map | `<map>` | no |
| labels | Labels to be attached to the buckets | map | `<map>` | no |
Expand All @@ -60,12 +60,12 @@ Functional examples are included in the
| names | Bucket name suffixes. | list(string) | n/a | yes |
| prefix | Prefix used to generate the bucket name. | string | n/a | yes |
| project\_id | Bucket project id. | string | n/a | yes |
| set\_admin\_roles | Grant roles/storage.objectAdmin role to admins and bucket_admins. | string | `"false"` | no |
| set\_creator\_roles | Grant roles/storage.objectCreator role to creators and bucket_creators. | string | `"false"` | no |
| set\_viewer\_roles | Grant roles/storage.objectViewer role to viewers and bucket_viewers. | string | `"false"` | no |
| set\_admin\_roles | Grant roles/storage.objectAdmin role to admins and bucket_admins. | bool | `"false"` | no |
| set\_creator\_roles | Grant roles/storage.objectCreator role to creators and bucket_creators. | bool | `"false"` | no |
| set\_viewer\_roles | Grant roles/storage.objectViewer role to viewers and bucket_viewers. | bool | `"false"` | no |
| storage\_class | Bucket storage class. | string | `"MULTI_REGIONAL"` | no |
| versioning | Optional map of lowercase unprefixed name => boolean, defaults to false. | map | `<map>` | no |
| viewers | IAM-style members who will be granted roles/storage.objectViewer on all buckets. | list | `<list>` | no |
| viewers | IAM-style members who will be granted roles/storage.objectViewer on all buckets. | list(string) | `<list>` | no |

## Outputs

Expand Down
20 changes: 19 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

variable "project_id" {
description = "Bucket project id."
type = string
}

variable "prefix" {
description = "Prefix used to generate the bucket name."
type = string
}

variable "names" {
Expand All @@ -29,83 +31,99 @@ variable "names" {

variable "location" {
description = "Bucket location."
type = string
default = "EU"
}

variable "storage_class" {
description = "Bucket storage class."
type = string
default = "MULTI_REGIONAL"
}

variable "force_destroy" {
description = "Optional map of lowercase unprefixed name => boolean, defaults to false."
type = map
default = {}
}

variable "versioning" {
description = "Optional map of lowercase unprefixed name => boolean, defaults to false."
type = map
default = {}
}

variable "encryption_key_names" {
description = "Optional map of lowercase unprefixed name => string, empty strings are ignored."
type = map
default = {}
}

variable "bucket_policy_only" {
description = "Disable ad-hoc ACLs on specified buckets. Defaults to true. Map of lowercase unprefixed name => boolean"
type = map
default = {}
}

variable "admins" {
description = "IAM-style members who will be granted roles/storage.objectAdmin on all buckets."
type = list(string)
default = []
}

variable "creators" {
description = "IAM-style members who will be granted roles/storage.objectCreators on all buckets."
type = list(string)
default = []
}

variable "viewers" {
description = "IAM-style members who will be granted roles/storage.objectViewer on all buckets."
type = list(string)
default = []
}

variable "bucket_admins" {
description = "Map of lowercase unprefixed name => comma-delimited IAM-style bucket admins."
type = map
default = {}
}

variable "bucket_creators" {
description = "Map of lowercase unprefixed name => comma-delimited IAM-style bucket creators."
type = map
default = {}
}

variable "bucket_viewers" {
description = "Map of lowercase unprefixed name => comma-delimited IAM-style bucket viewers."
type = map
default = {}
}

variable "labels" {
description = "Labels to be attached to the buckets"
type = map
default = {}
}

# we need flags to allow member lists to contain dynamic elements

variable "set_admin_roles" {
description = "Grant roles/storage.objectAdmin role to admins and bucket_admins."
type = bool
default = false
}

variable "set_creator_roles" {
description = "Grant roles/storage.objectCreator role to creators and bucket_creators."
type = bool
default = false
}

variable "set_viewer_roles" {
description = "Grant roles/storage.objectViewer role to viewers and bucket_viewers."
type = bool
default = false
}

Expand All @@ -117,6 +135,6 @@ variable "lifecycle_rules" {
})
condition = map(string)
}))
default = []
description = "List of lifecycle rules to configure. Format is the same as described in provider documentation https://www.terraform.io/docs/providers/google/r/storage_bucket.html#lifecycle_rule except condition.matches_storage_class should be a comma delimited string."
default = []
}