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

Tags in S3 lifecycle_rule not supported #1778

Closed
hashibot opened this issue Sep 29, 2017 · 4 comments
Closed

Tags in S3 lifecycle_rule not supported #1778

hashibot opened this issue Sep 29, 2017 · 4 comments
Labels
bug Addresses a defect in current functionality.

Comments

@hashibot
Copy link

This issue was originally opened by @Timboo89 as hashicorp/terraform#16153. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

0.10.2

Terraform Configuration Files

resource "aws_s3_bucket" "bucket" {
  bucket = "my-bucket"
  acl    = "private"

  lifecycle_rule {
    id      = "log"
    enabled = true

    tags {
      "rule"      = "log"
      "retention" = "403"
    }

    transition {
      days          = 403
      storage_class = "GLACIER"
    }
  }
}

Expected Behavior

Create a bucket with a lifecycle rule thats moves files after 403 days to glacier.

Actual Behavior

Just creates a simple S3 Bucket without lifecycle rules.

Steps to Reproduce

  1. terraform init
  2. terraform apply

Work-a-round

Just don't use tags in lifecycle rules:

resource "aws_s3_bucket" "bucket" {
  bucket = "my-bucket"
  acl    = "private"

  lifecycle_rule {
    id      = "log"
    enabled = true

    transition {
      days          = 403
      storage_class = "GLACIER"
    }
  }
}
@hashibot hashibot added the bug Addresses a defect in current functionality. label Sep 29, 2017
@grimm26
Copy link
Contributor

grimm26 commented Sep 29, 2017

Works for me in 0.10.6

provider "aws" {}

resource "aws_s3_bucket" "bucket" {
  bucket = "mk3-bucket"
  acl    = "private"

  lifecycle_rule {
    id      = "log"
    enabled = true

    tags {
      "rule"      = "log"
      "retention" = "403"
    }

    transition {
      days          = 403
      storage_class = "GLACIER"
    }
  }
}
% terraform apply                                                                                                                        :(
aws_s3_bucket.bucket: Creating...
  acceleration_status:                                 "" => "<computed>"
  acl:                                                 "" => "private"
  arn:                                                 "" => "<computed>"
  bucket:                                              "" => "mk3-bucket"
  bucket_domain_name:                                  "" => "<computed>"
  force_destroy:                                       "" => "false"
  hosted_zone_id:                                      "" => "<computed>"
  lifecycle_rule.#:                                    "" => "1"
  lifecycle_rule.0.enabled:                            "" => "true"
  lifecycle_rule.0.id:                                 "" => "log"
  lifecycle_rule.0.tags.%:                             "" => "2"
  lifecycle_rule.0.tags.retention:                     "" => "403"
  lifecycle_rule.0.tags.rule:                          "" => "log"
  lifecycle_rule.0.transition.#:                       "" => "1"
  lifecycle_rule.0.transition.312632119.date:          "" => ""
  lifecycle_rule.0.transition.312632119.days:          "" => "403"
  lifecycle_rule.0.transition.312632119.storage_class: "" => "GLACIER"
  region:                                              "" => "<computed>"
  request_payer:                                       "" => "<computed>"
  versioning.#:                                        "" => "<computed>"
  website_domain:                                      "" => "<computed>"
  website_endpoint:                                    "" => "<computed>"
aws_s3_bucket.bucket: Creation complete after 4s (ID: mk3-bucket)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
% aws s3api get-bucket-lifecycle-configuration --bucket mk3-bucket --output text
RULES   log     Enabled
AND
TAGS    rule    log
TAGS    retention       403
TRANSITIONS     403     GLACIER

@bdashrad
Copy link

This has been fixed since version 0.1.2 / #899.

@Ninir
Copy link
Contributor

Ninir commented Nov 10, 2017

Thanks for the ping here @bdashrad !

@Ninir Ninir closed this as completed Nov 10, 2017
@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

No branches or pull requests

4 participants