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

Feat: Enable Replication Metrics #116

Merged
merged 5 commits into from
Feb 7, 2022

Conversation

max-lobur
Copy link
Contributor

@max-lobur max-lobur commented Nov 8, 2021

what

  • Enable replication metrics by default
  • Allow override via variables

AWS provider requirements update due to: hashicorp/terraform-provider-aws#21901

why

  • To be able to track replication status

references

https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-metrics.html

@max-lobur max-lobur requested review from a team as code owners November 8, 2021 15:56
@max-lobur max-lobur force-pushed the replication_metrics branch 3 times, most recently from 719c247 to 0aada29 Compare December 6, 2021 15:46
@max-lobur
Copy link
Contributor Author

/test all

@max-lobur max-lobur force-pushed the replication_metrics branch from 1249064 to fba6c3e Compare December 6, 2021 16:19
@max-lobur
Copy link
Contributor Author

/test all

}
}
] : null
s3_replication_rules = local.replication_enabled ? local.replication_rules : null
Copy link
Member

Choose a reason for hiding this comment

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

How come var.s3_replication_rules is no longer used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's my temp mess in tests nvm :)

@max-lobur max-lobur force-pushed the replication_metrics branch from 43dae0b to 040d727 Compare December 6, 2021 17:15
@max-lobur
Copy link
Contributor Author

/test all

@max-lobur max-lobur force-pushed the replication_metrics branch 2 times, most recently from 407dee6 to 001630e Compare December 6, 2021 20:10
@mergify
Copy link

mergify bot commented Jan 5, 2022

This pull request is now in conflict. Could you fix it @max-lobur? 🙏

@korenyoni korenyoni added enhancement New feature or request no-release Do not create a new release (wait for additional code changes) labels Jan 16, 2022
@korenyoni
Copy link
Member

/test all

test/Makefile Outdated Show resolved Hide resolved
@korenyoni
Copy link
Member

/test all

2 similar comments
@korenyoni
Copy link
Member

/test all

@korenyoni
Copy link
Member

/test all

@korenyoni korenyoni force-pushed the replication_metrics branch from e6bab0c to fd4de00 Compare January 16, 2022 21:15
@korenyoni
Copy link
Member

/test all

@korenyoni korenyoni force-pushed the replication_metrics branch 2 times, most recently from 64a4328 to f565abf Compare January 16, 2022 21:23
@korenyoni
Copy link
Member

/test all

@korenyoni
Copy link
Member

@max-lobur I took over this PR a little bit and made some changes to get it closer to what I think is ready to merge. I'm still running into the following:

│ Error: Error putting S3 replication configuration: InvalidArgument: Metrics cannot contain an event threshold when ReplicationTime is not specified or Disabled
│       status code: 400, request id: [REDACTED], host id: [REDACTED]
│ 
│   with module.s3_bucket.aws_s3_bucket.default[0],
│   on ../../main.tf line 14, in resource "aws_s3_bucket" "default":
│   14: resource "aws_s3_bucket" "default" {
│ 
╵

main.tf Outdated Show resolved Hide resolved
@max-lobur max-lobur force-pushed the replication_metrics branch 2 times, most recently from b6a9eb7 to 08fa92a Compare January 30, 2022 21:00
@mergify mergify bot dismissed korenyoni’s stale review January 30, 2022 21:00

This Pull Request has been updated, so we're dismissing all reviews.

@max-lobur max-lobur force-pushed the replication_metrics branch from 08fa92a to 2ecfc34 Compare January 30, 2022 21:02
@max-lobur
Copy link
Contributor Author

/test all

@max-lobur max-lobur force-pushed the replication_metrics branch from 94453a2 to 8874e6f Compare January 30, 2022 21:23
@max-lobur max-lobur force-pushed the replication_metrics branch from 96d02b6 to 54bb138 Compare January 30, 2022 21:27
@max-lobur
Copy link
Contributor Author

/test all

@max-lobur max-lobur removed the no-release Do not create a new release (wait for additional code changes) label Jan 30, 2022
@max-lobur max-lobur requested a review from korenyoni January 30, 2022 21:42
Copy link
Member

@korenyoni korenyoni left a comment

Choose a reason for hiding this comment

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

Couple comments, will finish reviewing tomorrow morning

variables.tf Outdated Show resolved Hide resolved
main.tf Show resolved Hide resolved
Copy link
Member

@korenyoni korenyoni left a comment

Choose a reason for hiding this comment

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

Requested some changes — see comments

variables.tf Outdated Show resolved Hide resolved
main.tf Outdated
Comment on lines 201 to 203
content {
minutes = 15
}
Copy link
Member

Choose a reason for hiding this comment

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

This looks as if we are hardcoding it. We should add an inline comment clarifying that it is not. Also, we need to set the enabled attribute here.

Suggested change
content {
minutes = 15
}
content {
status = "Enabled"
# we are not hardcoding this value — rather, this is the only value accepted by the provider, either implicitly or explicitly.
minutes = 15
}

Copy link
Contributor Author

@max-lobur max-lobur Jan 31, 2022

Choose a reason for hiding this comment

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

the link I posted has this
https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-walkthrough-5.html

image

i added comment

Honestly i'm waiting until they re-release this whole api as it's a total nonsense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not make sense to build any further around this until they redo the api

main.tf Outdated
Comment on lines 193 to 195
content {
status = "Enabled"
}
Copy link
Member

Choose a reason for hiding this comment

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

See other comment with the same suggestion.

Suggested change
content {
status = "Enabled"
}
content {
status = "Enabled"
# we are not hardcoding this value — rather, this is the only value accepted by the provider, either implicitly or explicitly.
minutes = 15
}

Copy link
Contributor Author

@max-lobur max-lobur Jan 31, 2022

Choose a reason for hiding this comment

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

minutes are ignored here

correct syntax is

metrics {
  event_threshold {
    minutes = 15
  }
  status = "Enabled"
}

but it's not supported by the latest aws provider, I don't know why

the event_threshold block throws an error. It works without it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@korenyoni korenyoni changed the title Enable replication metrics Feat: Enable Replication Metrics Jan 31, 2022
Co-authored-by: Yonatan Koren <[email protected]>
@mergify mergify bot dismissed korenyoni’s stale review January 31, 2022 12:18

This Pull Request has been updated, so we're dismissing all reviews.

@max-lobur
Copy link
Contributor Author

/test all

@max-lobur
Copy link
Contributor Author

/test all

@max-lobur max-lobur requested a review from korenyoni February 7, 2022 14:11
Copy link
Member

@korenyoni korenyoni left a comment

Choose a reason for hiding this comment

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

LGTM

@max-lobur max-lobur merged commit f61532b into cloudposse:master Feb 7, 2022
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.

4 participants