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

Fix/17/lifecycle rules #19

Merged

Conversation

kopachevsky
Copy link
Contributor

@kopachevsky kopachevsky commented Nov 4, 2019

Added lifecycle_rules variable and corresponding dynamic block.

Fixes #17

@aaron-lane aaron-lane added the enhancement New feature or request label Nov 4, 2019
examples/simple_example/variables.tf Outdated Show resolved Hide resolved
main.tf Show resolved Hide resolved
test/integration/simple_example/controls/gsutil.rb Outdated Show resolved Hide resolved
@kopachevsky kopachevsky marked this pull request as ready for review November 15, 2019 16:23
README.md Outdated
@@ -1,4 +1,4 @@
# Terraform Google Cloud Storage Module
# Terraform Google Cloud Storage Module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a misformatting? Shouldn't have a tab here.

@@ -24,5 +24,6 @@ module "cloud_storage" {
prefix = var.prefix
names = var.names
bucket_policy_only = var.bucket_policy_only
lifecycle_rules = var.lifecycle_rules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please hard-code an example directly instead of making this a variable.

variables.tf Outdated
condition = map(string)
}))
default = []
description = "The bucket's Lifecycle Rules configuration. Multiple blocks of this type are permitted. 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 - it should be comma delimited string."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to "blocks" is confusing in this context.

Instead we should say something like:

Suggested change
description = "The bucket's Lifecycle Rules configuration. Multiple blocks of this type are permitted. 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 - it should be comma delimited string."
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."

@kopachevsky kopachevsky force-pushed the fix/17/lifecycle-rules branch from 0cf510b to 8ac280f Compare November 20, 2019 12:09
@kopachevsky
Copy link
Contributor Author

@morgante please re-review

@kopachevsky kopachevsky requested a review from morgante November 20, 2019 12:18
@@ -34,3 +34,14 @@ variable "bucket_policy_only" {
type = map(string)
}

variable "lifecycle_rules" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're hardcoding this now, can we remove the variable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kopachevsky To be clear, I don't want any variables for lifecycle_rules in either examples or fixtures, it can just be hardcoded in the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did it in example

Copy link
Contributor

@morgante morgante Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you still have a variable in the example. Please remove the variables, as I've said a number of times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, my mistake

@@ -19,3 +19,14 @@ variable "project_id" {
type = string
}

variable "lifecycle_rules" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove variable.

@@ -34,5 +34,16 @@ module "example" {
"one" = true
"two" = false
}

lifecycle_rules = [{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove, this is set in the example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morgante make sense to leave it in once place, you suggest to set it in example but not here, right?

@kopachevsky kopachevsky force-pushed the fix/17/lifecycle-rules branch 3 times, most recently from b58a0c1 to 7b7d9a6 Compare November 20, 2019 15:10
@@ -8,6 +8,7 @@ This example illustrates how to use the `cloud-storage` module.
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| bucket\_policy\_only | Disable ad-hoc ACLs on specified buckets. Defaults to true. Map of lowercase unprefixed name => boolean | map(string) | n/a | yes |
| lifecycle\_rules | 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. | object | `<list>` | no |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kopachevsky Please regenerate docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Added support for lifecycle rules
Updated tests and lints
Updated variables and readme files
@kopachevsky kopachevsky force-pushed the fix/17/lifecycle-rules branch from 7b7d9a6 to 317c5a5 Compare November 20, 2019 15:13
Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like tests are failing, please fix.

@kopachevsky kopachevsky force-pushed the fix/17/lifecycle-rules branch from 5cd02b7 to ed63d28 Compare November 20, 2019 16:04
@kopachevsky
Copy link
Contributor Author

Looks like tests are failing, please fix.

fixed

@morgante morgante merged commit 9514fd0 into terraform-google-modules:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for lifecycle rules
5 participants