-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Amazon GuardDuty supports exporting findings to an Amazon S3 bucket #10920 #12398
Amazon GuardDuty supports exporting findings to an Amazon S3 bucket #10920 #12398
Conversation
}, | ||
"destination_arn": { | ||
Type: schema.TypeString, | ||
Required: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ValidateFunc: validateArn,
?
}, | ||
"kms_key_arn": { | ||
Type: schema.TypeString, | ||
Required: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ValidateFunc: validateArn,
?
"destination_type": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "S3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use AWS SDK-provided constant guardduty.DestinationTypeS3
.
} | ||
resp, err := conn.DescribePublishingDestination(input) | ||
if err != nil { | ||
return nil, "failed", err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add as
// Constants not currently provided by the AWS Go SDK
const (
guardDutyPublishingStatusFailed = "FAILED"
)
at top of file?
func resourceAwsGuardDutyPublishingDestinationRead(d *schema.ResourceData, meta interface{}) error { | ||
conn := meta.(*AWSClient).guarddutyconn | ||
|
||
destination_id, detector_id, err_state_read := decodeGuardDutyPublishDestinationID(d.Id()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer camelCase over snake_case here (and others).
} | ||
|
||
log.Printf("[DEBUG] Delete GuardDuty publishing destination: %s", input) | ||
_, err := conn.DeletePublishingDestination(&input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the PublishingDestination has been deleted outside Terraform?
Do we need the if isAWSErr(err, guardduty.ErrCodeBadRequestException,...
check here?
Hi @shaepe. Thanks for this PR, my team is looking to use this resource and I'm wondering if you will have the time to address the review from @ewbankkit, otherwise we could do that to make progress on your PR. |
* Merged latest master changes and resolved conflicts
Type: schema.TypeString, | ||
Optional: true, | ||
Default: guardduty.DestinationTypeS3, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
ValidateFunc: validation.StringInSlice([]string{
guardduty.DestinationTypeS3,
}, false),
guardduty.PublishingStatusPublishing, err) | ||
} | ||
|
||
d.SetId(fmt.Sprintf("%s:%s", d.Get("detector_id"), *output.DestinationId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d.SetId(fmt.Sprintf("%s:%s", d.Get("detector_id"), aws.StringValue(output.DestinationId)))
return fmt.Errorf("Creating GuardDuty publishing destination failed: %s", err.Error()) | ||
} | ||
|
||
stateConf := &resource.StateChangeConf{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move this code to aws/internal/service/guardduty/waiter
and follow the pattern there?
See #12840.
@ewbankkit moved to new PR since original author is unresponsive: #13894 |
Closing in favour of #13894. |
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! |
Community Note
Closes #10920
Release note for CHANGELOG:
Output from acceptance testing: