pulumi-aws: Invalid ARN when creating aws.wafv2.WebAclLoggingConfiguration

When trying to create aws.wafv2.WebAclLoggingConfiguration it fails with The ARN isn’t valid. A valid ARN begins with arn: and includes other information separated by colons or slashes. Thing is that the arn format its ok, spoke with AWS support and they said that all the setup was made properly for aws and api calls so it seems to be a pulumi issue.

Here is the example code from @pulumi/aws module:

const example = new aws.wafv2.WebAclLoggingConfiguration("example", {
logDestinationConfigs: [aws_kinesis_firehose_delivery_stream.example.arn],
resourceArn: aws_wafv2_web_acl.example.arn,
redactedFields: [{
singleHeader: {
name: "user-agent",
},
}],
});

And this is my code:

const waflogging = new aws.wafv2.WebAclLoggingConfiguration("model-builder-waflogging", {
logDestinationConfigs: [kinesisStream.arn], 
resourceArn: wafwebacl.arn // I tried to manually add as string but same issue. 
}, { dependsOn: kinesisStream });

When I run Pulumi, I have the following error:

* error putting WAFv2 Logging Configuration for resource (arn:aws:wafv2:us-east-1:796031763495:global/webacl/modelbuilderCF/80986c63-50d8-4775-b82e-91339616cc81): WAFInvalidParameterException: Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN, parameter: arn:aws:wafv2:us-east-1:796031763495:global/webacl/modelbuilderCF/80986c63-50d8-4775-b82e-91339616cc81
{
RespMetadata: {
StatusCode: 400,
RequestID: "79d08de5-b145-4eb5-9f35-c67ef076f3ac"
},
Field: "RESOURCE_ARN",
Message_: "Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN, parameter: arn:aws:wafv2:us-east-1:796031763495:global/webacl/modelbuilderCF/80986c63-50d8-4775-b82e-91339616cc81",
Parameter: "arn:aws:wafv2:us-east-1:796031763495:global/webacl/modelbuilderCF/80986c63-50d8-4775-b82e-91339616cc81",
Reason: "The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes."
}

For now I had to manually enable logging to my webacl v2 but It will be nice to have it all done from Pulumi. Please advise if its something I do wrong or is there any other constructor that I can use to configure logging. I tried to add the ARN as string but same outcome.

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 25 (3 by maintainers)

Most upvoted comments

You need to ensure your delivery stream’s name begins with aws-waf-logs-.

I got this error:

│ Error: putting WAFv2 Logging Configuration for resource (arn:aws:wafv2:us-west-1:937188154488:regional/webacl/lf-dev-alb-acl/8f5cda88-eb7b-4e8b-b282-b9305e01c175): WAFInvalidParameterException: Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: LOG_DESTINATION, parameter: arn:aws:logs:us-west-1:937188154488:log-group:WAF-logs-alb
│ {
│   RespMetadata: {
│     StatusCode: 400,
│     RequestID: "68de46b8-3fc2-41f5-9fd3-9bd759da47ff"
│   },
│   Field: "LOG_DESTINATION",
│   Message_: "Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: LOG_DESTINATION, parameter: arn:aws:logs:us-west-1:937188154488:log-group:WAF-logs-alb",
│   Parameter: "arn:aws:logs:us-west-1:937188154488:log-group:WAF-logs-alb",
│   Reason: "The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes."
│ }
│ 
│   with module.infra.aws_wafv2_web_acl_logging_configuration.waf_log,
│   on ../stack/waf.tf line 180, in resource "aws_wafv2_web_acl_logging_configuration" "waf_log":
│  180: resource "aws_wafv2_web_acl_logging_configuration" "waf_log" {

I fix this issue, for CloudWatch logging by adding at the beginning, in the name of the aws_cloudwatch_log_group, the prefix aws-waf-logs

resource "aws_cloudwatch_log_group" "alb-waf-log" {
    //FOR WAF name must start with aws-waf-logs
    name = "aws-waf-logs-alb"
}

resource "aws_wafv2_web_acl_logging_configuration" "waf_log" {
  log_destination_configs = [aws_cloudwatch_log_group.alb-waf-log.arn]
  resource_arn            = aws_wafv2_web_acl.waf-acl.arn
  }

Not only for Kinesis logging, but it goes the same for CloudWatch logging.

const logGroup:aws_logs.LogGroup = new aws_logs.LogGroup(this, `logGroupWaf`, {
  retention: 30,
  logGroupName: `aws-waf-logs-abc`
});

What an absolute scam

This was fixed by doing the following:

Closing issue.

Hi @emiioan - I had this same issue but when using Terraform, which led me here, and as it turns out the issue was in between the chair and the keyboard, as I forgot to set the region to us-east-1 for this resource creation, hence the ARN validation error 😃 Hopefully this helps!

It’s been 4 years and this problem still hasn’t been fixed 😒

@ricoli I am experiencing the same. It is failing even with provider = aws.us-east-1 on association resource. Aliased provider is configured for the region. Would you have any other ideas what to check?

Even I was facing the same issue with TF, dropped by here. Tried adding region under provider section and this worked.

@ricoli I am experiencing the same. It is failing even with provider = aws.us-east-1 on association resource. Aliased provider is configured for the region. Would you have any other ideas what to check?

ah no sorry, my problem was the missing alias configuration

you need to replace “global” in the arn string to “regional”

Just want to add that aws.kinesis.FirehoseDeliveryStream(“aws-waf-logs-modelbuilderStream”) was created in us-east-1 for waf logging as the waf is assigned to CloudFront and the name is prefixed with ‘aws-waf-logs-’ as aws recommends (https://docs.aws.amazon.com/waf/latest/developerguide/logging.html)