terraforming
terraforming copied to clipboard
improve-s3
Add many features for s3.
- [X] Cors https://github.com/dtan4/terraforming/issues/289
- [X] Website https://github.com/dtan4/terraforming/issues/255
- [X] Lifecycle rule https://github.com/dtan4/terraforming/issues/232
- [X] Tags
- [X] Versioning
- [X] Logging
- [ ] Fix tests
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.
Coverage decreased (-0.4%) to 99.639% when pulling b9ebfdef04f4530c57925d8ba77a3a2a3bef9333 on sergeylanzman:improve-s3 into c1d467becef5645e14ff822860f3fc2a9868c066 on dtan4:master.
Coverage decreased (-0.4%) to 99.639% when pulling b9ebfdef04f4530c57925d8ba77a3a2a3bef9333 on sergeylanzman:improve-s3 into c1d467becef5645e14ff822860f3fc2a9868c066 on dtan4:master.
Coverage decreased (-0.4%) to 99.639% when pulling 5bd2c4d3b8217d72293d9f1bc952d4da0d0ed2d7 on sergeylanzman:improve-s3 into c1d467becef5645e14ff822860f3fc2a9868c066 on dtan4:master.
Sorry for the late review, but could you update unit tests at first?
Thank you for sending a patch to improve!
@sergeylanzman @dtan4 Is this currently being worked on? If not then I can produce the tests and get it merged to master?
@alexmirkhaydarov I not working on this. I be happy if you can fix tests
@alexmirkhaydarov please fix the tests
@GETandSELECT sure, I will try to add the tests in few weeks time.
@GETandSELECT @alexmirkhaydarov I wrote more generic solution for reverse terraform process include full support S3 https://github.com/GoogleCloudPlatform/terraformer
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?
@alexmirkhaydarov Done
Pushed the changes to this branch now to fix the tests. Can you have a look @dtan4?
What's the status on this? Can it be merged?