Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

improve-s3 #396

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

improve-s3 #396

wants to merge 4 commits into from

Conversation

sergeylanzman
Copy link

@sergeylanzman sergeylanzman commented Feb 8, 2018

Add many features for s3.

Before

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

After

resource "aws_s3_bucket" "my_bucket" {
  bucket = "my-bucket"
  acl = "private"
 policy = <<POLICY
{
  "Version": "2012-10-17",
  "Id": "AWSConsole-AccessLogs-Policy-1414336270042",
  "Statement": [
    {
      "Sid": "AWSConsoleStmt-1414336270042",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::44444:root"
      },
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::test/AWSLogs/34345/*"
    }
  ]
}
POLICY
  tags {
    "k8s" = "backup"
  }
  cors_rule {
    allowed_methods = [
      "GET"]
    allowed_origins = [
      "*"]
    allowed_headers = [
      "Authorization"]
    max_age_seconds = 3000
  }
  versioning {
    enabled = true
  }
  logging {
    target_bucket = "test"
    target_prefix = ""
  }
  lifecycle_rule {
    id = "Remove 7 days old backups"
    enabled = true
    prefix = ""
    transition {
      storage_class = "STANDARD_IA"
      days = 30
    }
    expiration {
      days = 31
    }
    noncurrent_version_transition {
      days = 30
      storage_class = "STANDARD_IA"
    }
    noncurrent_version_expiration {
      days = 31
    }
    abort_incomplete_multipart_upload_days = 7
  }
  website {
    index_document = "index.html"
    error_document = "ett.html"
    routing_rules = <<EOF
        [
  {
    "condition": {
      "http_error_code_returned_equals": "403"
    },
    "redirect": {
      "host_name": "mywebsite.com",
      "replace_key_prefix_with": "notfound/"
    }
  }
]
    EOF
  }
}

Know issue tfstate not update for new features, but you can run terraform refresh.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 99.639% when pulling b9ebfde on sergeylanzman:improve-s3 into c1d467b on dtan4:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 99.639% when pulling b9ebfde on sergeylanzman:improve-s3 into c1d467b on dtan4:master.

@coveralls
Copy link

coveralls commented Feb 8, 2018

Coverage Status

Coverage decreased (-0.4%) to 99.639% when pulling 5bd2c4d on sergeylanzman:improve-s3 into c1d467b on dtan4:master.

impove
@dtan4
Copy link
Owner

dtan4 commented Sep 2, 2018

Sorry for the late review, but could you update unit tests at first?

Thank you for sending a patch to improve!

@alexdotsh
Copy link

@sergeylanzman @dtan4 Is this currently being worked on? If not then I can produce the tests and get it merged to master?

@sergeylanzman
Copy link
Author

@alexmirkhaydarov I not working on this. I be happy if you can fix tests

@GETandSELECT
Copy link

@alexmirkhaydarov please fix the tests

@alexdotsh
Copy link

@GETandSELECT sure, I will try to add the tests in few weeks time.

@sergeylanzman
Copy link
Author

sergeylanzman commented Jun 24, 2019

@GETandSELECT @alexmirkhaydarov
I wrote more generic solution for reverse terraform process
include full support S3
https://github.com/GoogleCloudPlatform/terraformer

@alexdotsh alexdotsh mentioned this pull request Jul 7, 2019
1 task
@alexdotsh
Copy link

I have fixed the tests under this PR
It includes the original work from sergeylanzman and on top of it I added the tests.
I'd be happy to push the changes to this branch @sergeylanzman - If you give me access to your repo?

@sergeylanzman
Copy link
Author

@alexmirkhaydarov Done

@alexdotsh
Copy link

Pushed the changes to this branch now to fix the tests.
Can you have a look @dtan4?

@dimisjim
Copy link

What's the status on this? Can it be merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants