terraform-google-cloud-storage icon indicating copy to clipboard operation
terraform-google-cloud-storage copied to clipboard

add Lifecycle conditions: MatchesPrefix, MatchesSuffix

Open elopsod opened this issue 2 years ago β€’ 8 comments

Support for new Lifecycle conditions: MatchesPrefix, MatchesSuffix

elopsod avatar Aug 12 '22 12:08 elopsod

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 12 '22 12:08 google-cla[bot]

Any progress here to merge required feature?

idestis avatar Sep 16 '22 07:09 idestis

Thanks for the PR @elops-od Can we also add this to the main module? We will need to update the min provider version to 4.31 per https://github.com/hashicorp/terraform-provider-google/blob/main/CHANGELOG.md#4310-aug-1-2022

https://github.com/terraform-google-modules/terraform-google-cloud-storage/blob/80fa9e1fb247e9e86a1326157822687245661aa6/versions.tf#L23

https://github.com/terraform-google-modules/terraform-google-cloud-storage/blob/80fa9e1fb247e9e86a1326157822687245661aa6/modules/simple_bucket/versions.tf#L23

https://github.com/terraform-google-modules/terraform-google-cloud-storage/blob/80fa9e1fb247e9e86a1326157822687245661aa6/main.tf#L112-L131

hi done

elopsod avatar Sep 27 '22 08:09 elopsod

hi @bharathkkb could you pls review thank you

elopsod avatar Sep 29 '22 06:09 elopsod

Could you add this to the main module too?

https://github.com/terraform-google-modules/terraform-google-cloud-storage/blob/80fa9e1fb247e9e86a1326157822687245661aa6/main.tf#L112-L131

hi done

elopsod avatar Sep 30 '22 08:09 elopsod

@bharathkkb any progress with a review on this? The feature is really needed to use the module.

idestis avatar Oct 07 '22 08:10 idestis

Would love seeing this getting merged! Is there anything that is missing?

muffl0n avatar Oct 19 '22 08:10 muffl0n

@elops-od Thanks for the PR! πŸš€
βœ… Lint checks have passed.

comment-bot-dev avatar Nov 01 '22 13:11 comment-bot-dev

hi @bharathkkb @muffl0n any updates about merge ?

elopsod avatar Nov 08 '22 12:11 elopsod

Hi @elops-od - Thanks for the contribution! It looks like the Integration test is currently failing with:

Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; β•·
β”‚ Error: Incorrect attribute value type
β”‚ 
β”‚   on ../../main.tf line 129, in resource "google_storage_bucket" "buckets":
β”‚  129:         matches_prefix             = lookup(lifecycle_rule.value.condition, "matches_prefix", null)
β”‚ 
β”‚ Inappropriate value for attribute "matches_prefix": list of string
β”‚ required.
β•΅
``

apeabody avatar Nov 08 '22 16:11 apeabody

https://github.com/terraform-google-modules/terraform-google-cloud-storage/pull/183#issuecomment-1307455988 changed to

        matches_prefix             = lookup(lifecycle_rule.value.condition, "matches_prefix", [])
        matches_suffix             = lookup(lifecycle_rule.value.condition, "matches_suffix", [])

but still get this error @apeabody what I do wrong

elopsod avatar Nov 14 '22 08:11 elopsod

@apeabody @muffl0n @bharathkkb hi guys any updates on this ?

elopsod avatar Dec 10 '22 08:12 elopsod

@elops-od, no need to tag me as I'm neither a contributor to this PR nor a maintainer of this project. I'm just someone who would love to see this getting implemented.

muffl0n avatar Dec 10 '22 08:12 muffl0n

@elops-od Thanks for the PR! πŸš€ Unfortunately it looks like some of our CI checks failed. See the Contributing Guide for details.

  • ⚠️check_tflint Failed TFlint check. More details below.
Checking for tflint
Working in . ...
Failed to load configurations; main.tf:131,9-23: Attribute redefined; The argument "matches_prefix" was already set at main.tf:124,9-23. Each argument may be set only once., and 1 other diagnostic(s):
Error: Attribute redefined
 on main.tf line 131, in resource "google_storage_bucket" "buckets":
131:         matches_prefix             = lookup(lifecycle_rule.value.condition, "matches_prefix", [])
The argument "matches_prefix" was already set at main.tf:124,9-23. Each argument may be set only once.
Error: Attribute redefined
 on main.tf line 132, in resource "google_storage_bucket" "buckets":
132:         matches_suffix             = lookup(lifecycle_rule.value.condition, "matches_suffix", [])
The argument "matches_suffix" was already set at main.tf:125,9-23. Each argument may be set only once.
tflint failed . 
Working in ./examples/multiple_buckets ...
tflint passed ./examples/multiple_buckets 
Working in ./examples/simple_bucket ...
tflint passed ./examples/simple_bucket 
Working in ./modules/simple_bucket ...
Failed to load configurations; main.tf:82,9-23: Attribute redefined; The argument "matches_prefix" was already set at main.tf:75,9-23. Each argument may be set only once., and 1 other diagnostic(s):
Error: Attribute redefined
 on main.tf line 82, in resource "google_storage_bucket" "bucket":
 82:         matches_prefix             = lookup(lifecycle_rule.value.condition, "matches_prefix", [])
The argument "matches_prefix" was already set at main.tf:75,9-23. Each argument may be set only once.
Error: Attribute redefined
 on main.tf line 83, in resource "google_storage_bucket" "bucket":
 83:         matches_suffix             = lookup(lifecycle_rule.value.condition, "matches_suffix", [])
The argument "matches_suffix" was already set at main.tf:76,9-23. Each argument may be set only once.
tflint failed ./modules/simple_bucket 
Skipping ./test/setup
  • ⚠️check_terraform Failed Terraform check. More details below.
Running terraform fmt
β•·
β”‚

Error: 
Attribute redefined
β”‚

β”‚

 on main.tf line 131, in resource "google_storage_bucket" "buckets":
β”‚

131:         
matches_prefix
            = lookup(lifecycle_rule.value.condition, "matches_prefix", [])
β”‚

β”‚

The argument "matches_prefix" was already set at main.tf:124,9-23. Each
β”‚

argument may be set only once.
β•΅
β•·
β”‚

Error: 
Attribute redefined
β”‚

β”‚

 on main.tf line 132, in resource "google_storage_bucket" "buckets":
β”‚

132:         
matches_suffix
            = lookup(lifecycle_rule.value.condition, "matches_suffix", [])
β”‚

β”‚

The argument "matches_suffix" was already set at main.tf:125,9-23. Each
β”‚

argument may be set only once.
β•΅
Error: terraform fmt failed with exit code 2
Check the output for diffs and correct using terraform fmt <dir>
β•·
β”‚

Error: 
Attribute redefined
β”‚

β”‚

 on modules/simple_bucket/main.tf line 82, in resource "google_storage_bucket" "bucket":
β”‚

 82:         
matches_prefix
            = lookup(lifecycle_rule.value.condition, "matches_prefix", [])
β”‚

β”‚

The argument "matches_prefix" was already set at
β”‚

modules/simple_bucket/main.tf:75,9-23. Each argument may be set only once.
β•΅
β•·
β”‚

Error: 
Attribute redefined
β”‚

β”‚

 on modules/simple_bucket/main.tf line 83, in resource "google_storage_bucket" "bucket":
β”‚

 83:         
matches_suffix
            = lookup(lifecycle_rule.value.condition, "matches_suffix", [])
β”‚

β”‚

The argument "matches_suffix" was already set at
β”‚

modules/simple_bucket/main.tf:76,9-23. Each argument may be set only once.
β•΅
Error: terraform fmt failed with exit code 2
Check the output for diffs and correct using terraform fmt <dir>

comment-bot-dev avatar Jan 16 '23 08:01 comment-bot-dev