generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 121
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
Not able to create AWS CloudTrail resource with advanced event selector #1039
Labels
bug
runtime-handling
Relates to runtime handling and conversion of Terraform configuration to CloudFormation.
service/cloudtrail
Comments
Trying to reproduce this example (with random bucket names) I get
|
@kadrach , Please find the below complete Terraform code. I have missed to attach the S3 bucket policy document earlier. resource "awscc_cloudtrail_trail" "main2" {
trail_name = "example2"
is_logging = true
s3_bucket_name = awscc_s3_bucket.main.id
s3_key_prefix = "prefix"
include_global_service_events = false
advanced_event_selectors = [ {
name = "Log all S3 objects events except for two S3 buckets"
field_selectors = [ {
field = "eventCategory"
equals = ["Data"]
},
{
field = "resources.ARN"
not_starts_with = ["arn:aws:s3"]
},
{
field = "resources.type"
equals = ["AWS::S3::Object"]
} ]
} ]
}
resource "awscc_s3_bucket" "main" {
bucket_name = "sample-bucket-cloudtrail"
}
resource "awscc_s3_bucket" "example_bucket_1" {
bucket_name = "example-bucket-1-random"
}
resource "awscc_s3_bucket" "example_bucket_2" {
bucket_name = "example-bucket-2-random"
}
data "aws_iam_policy_document" "example" {
statement {
sid = "AWSCloudTrailAclCheck"
effect = "Allow"
principals {
type = "Service"
identifiers = ["cloudtrail.amazonaws.com"]
}
actions = ["s3:GetBucketAcl"]
resources = [awscc_s3_bucket.main.arn]
}
statement {
sid = "AWSCloudTrailWrite"
effect = "Allow"
principals {
type = "Service"
identifiers = ["cloudtrail.amazonaws.com"]
}
actions = ["s3:PutObject"]
resources = ["${awscc_s3_bucket.main.arn}/prefix/AWSLogs/${data.aws_caller_identity.current.account_id}/*"]
}
}
resource "aws_s3_bucket_policy" "example" {
bucket = awscc_s3_bucket.main.id
policy = data.aws_iam_policy_document.example.json
}
data "aws_caller_identity" "current" {}
data "aws_partition" "current" {}
data "aws_region" "current" {}
|
ewbankkit
added
runtime-handling
Relates to runtime handling and conversion of Terraform configuration to CloudFormation.
service/cloudtrail
and removed
needs-triage
labels
Nov 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
runtime-handling
Relates to runtime handling and conversion of Terraform configuration to CloudFormation.
service/cloudtrail
Community Note
Terraform CLI and Terraform AWS Cloud Control Provider Version
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Panic Output
I am able to create
awscc_cloudtrail_trail
with basic details. But when I try to create CloudTrail withadvanced_event_selectors
it fails with the above mentioned error. I tried to change value and provide static value for fieldresources.ARN
but it still gives same error. Can you please help me if I am using the correct schema or its an issue with provider itself.Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: