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

add support for dynamodb_table #244

Merged
merged 2 commits into from
Feb 12, 2021
Merged

add support for dynamodb_table #244

merged 2 commits into from
Feb 12, 2021

Conversation

moadibfr
Copy link
Contributor

Q A
πŸ› Bug fix? no
πŸš€ New feature? yes
⚠ Deprecations? no
❌ BC Break no
πŸ”— Related issues #210
❓ Documentation yes

Description

add support for dynamodb_table

@moadibfr moadibfr requested a review from a team as a code owner February 11, 2021 11:24
@codecov
Copy link

codecov bot commented Feb 11, 2021

Codecov Report

Merging #244 (faaf4a3) into main (ffceac4) will decrease coverage by 0.06%.
The diff coverage is 64.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #244      +/-   ##
==========================================
- Coverage   70.20%   70.13%   -0.07%     
==========================================
  Files         217      221       +4     
  Lines        4866     4922      +56     
==========================================
+ Hits         3416     3452      +36     
- Misses       1180     1195      +15     
- Partials      270      275       +5     
Impacted Files Coverage Ξ”
pkg/remote/aws/init.go 0.00% <0.00%> (ΓΈ)
pkg/remote/aws/dynamodb_table_supplier.go 62.96% <62.96%> (ΓΈ)
pkg/remote/aws/repository/dynamodb_repository.go 63.63% <63.63%> (ΓΈ)
...ce/aws/deserializer/dynamodb_table_deserializer.go 64.28% <64.28%> (ΓΈ)
pkg/iac/deserializers.go 100.00% <100.00%> (ΓΈ)
pkg/remote/resource_enumeration_error_handler.go 100.00% <100.00%> (ΓΈ)
pkg/resource/aws/aws_dynamodb_table.go 100.00% <100.00%> (ΓΈ)
... and 1 more

@moadibfr moadibfr force-pushed the fea/dymabodb_table branch 3 times, most recently from 4fa457f to fca6f2a Compare February 11, 2021 11:42

func (r *AwsDynamodbTable) NormalizeForState() (resource.Resource, error) {
// set default to empty struct for timeouts
if r.Timeouts == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a Terraform only related field, for consistency purpose it's more straightforward to handle it like in other resource by adding a diff:"-" annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ho you're right I thought these were real timeout not only used by tf...

message := fmt.Sprintf("Ignoring %s from drift calculation: Listing %s is forbidden.", listError.SupplierType(), listError.ListedTypeError())
logrus.Debugf(message)
//logrus.Debugf(message)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this line πŸ˜‰

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🀦

@@ -21,9 +21,9 @@ func HandleResourceEnumerationError(err error, alertr *alerter.Alerter) error {
return err
}

if reqerr.StatusCode() == 403 {
if reqerr.StatusCode() == 403 || strings.Contains(reqerr.Code(), "AccessDenied") {
Copy link
Contributor

Choose a reason for hiding this comment

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

To be sure to catch only this case maybe we could check the status code too ?

if reqerr.StatusCode() == 403 || (reqerr.StatusCode() == 400 && reqerr.Code() == "AccessDeniedException") {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what we saw AccessDeniedException is always access denied it does not depends on the http code so I remove te 400 check but no matter what we do we won't catch everything, 403 on dynamo is still another error.

Copy link
Contributor

@wbeuil wbeuil left a comment

Choose a reason for hiding this comment

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

Seems good !

@eliecharra eliecharra merged commit ab3c5d2 into main Feb 12, 2021
@eliecharra eliecharra deleted the fea/dymabodb_table branch February 12, 2021 14:26
@eliecharra eliecharra added this to the v0.5.0 milestone Feb 12, 2021
@eliecharra eliecharra added the kind/enhancement New feature or improvement label Feb 12, 2021
@eliecharra eliecharra linked an issue Feb 12, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for aws_dynamodb_table
3 participants