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

AWS CloudTrail Insights & ApiErrorRateInsight #21840

Closed
drmaciej opened this issue Nov 18, 2021 · 7 comments
Closed

AWS CloudTrail Insights & ApiErrorRateInsight #21840

drmaciej opened this issue Nov 18, 2021 · 7 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/cloudtrail Issues and PRs that pertain to the cloudtrail service.
Milestone

Comments

@drmaciej
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

CloudTrail Insights is designed to automatically analyze management events from your CloudTrail trails to establish a baseline for normal behavior, and then raise issues by generating Insights events when it detects unusual patterns.
ApiErrorRateInsight is a new type of insight offered.

New or Affected Resource(s)

Potential Terraform Configuration

resource "aws_cloudtrail" "example" {
  insight_selector {
    insight_type = "ApiCallRateInsight"
  }
  insight_selector {
    insight_type = "ApiErrorRateInsight"
  }
}

References

@drmaciej drmaciej added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 18, 2021
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/cloudtrail Issues and PRs that pertain to the cloudtrail service. labels Nov 18, 2021
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Nov 18, 2021
@DrFaust92
Copy link
Collaborator

Hi, the latest provider version already supports this, can you double check?

@drmaciej
Copy link
Author

Before creating this issue I tried with 3.65.0 - did not work.
I just checked with 3.66.0 and I see

│ Error: expected insight_selector.0.insight_type to be one of [ApiCallRateInsight], got ApiErrorRateInsight

@josephbleroy
Copy link

I'm having the same issue with the following provider terraform-provider-aws_v3.66.0_x5, using the following configuration:

    insight_selector {
        insight_type = "ApiCallRateInsight"
    }
    
    insight_selector {
        insight_type = "ApiErrorRateInsight"
    }

Here's the error when running terraform plan:

│ Error: expected insight_selector.1.insight_type to be one of [ApiCallRateInsight], got ApiErrorRateInsight
│ 
│   with aws_cloudtrail.compliance-cloudtrail,
│   on main.tf line 314, in resource "aws_cloudtrail" "compliance-cloudtrail":
│  314:         insight_type = "ApiErrorRateInsight"

@evilr00t
Copy link

@josephbleroy looks like it's valid behaviour based on docs: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail#insight_selector


insight_selector

This configuration block supports the following attributes:

    insight_type - (Optional) Type of insights to log on a trail. The valid value is ApiCallRateInsight

@DrFaust92 I don't see in the code anything related to ApiErrorRateInsight so I guess it hasn't been merged/prepared yet.

@DrFaust92
Copy link
Collaborator

Yeah seems it will be available next provider version. See my tests here on current main branch #21882

@ewbankkit
Copy link
Contributor

The new enumeration value has been available since AWS SDK v1.42.6 which was merged into main via #21853.
This functionality has been available since Terraform AWS Provider v3.67.0.

@ewbankkit ewbankkit added this to the v3.67.0 milestone Dec 2, 2021
@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/cloudtrail Issues and PRs that pertain to the cloudtrail service.
Projects
None yet
Development

No branches or pull requests

6 participants