AWS WAF v2 import failing

terraform import aws_wafv2_web_acl.example 8a4fc451-2f3e-4fc2-9720-10558d0e1e50/example/REGIONAL

aws wafv2 list-web-acls --scope REGIONAL

Hi All,
I’m trying to import an existing WAF webacl v2 using terraform.

import aws_wafv2_web_acl.example 8a4fc451-xxxxxx-xxxxxx-xxxxxx1e50/example/REGIONAL

However, import is failing with the following error:

Error: Cannot import non-existent remote object

│ While attempting to import an existing object to “aws_wafv2_web_acl.example”, the provider detected that no object exists with the given
│ id. Only pre-existing objects can be imported; check that the id is correct and that it is associated with the provider’s configured
│ region or endpoint, or use “terraform apply” to create a new remote object for this resource.

I’m able to list the webacl sucessfully using the cmd below:

aws wafv2 list-web-acls --scope REGIONAL

And I’ve the following in my main.tf file

terraform {
required_providers {
aws = {
source = “hashicorp/aws”
version = “4.21.0”
}
}

}

provider “aws” {
region = “us-east-1”
}

resource “aws_wafv2_web_acl” “example” {

}

Not sure causing this issue as i’m able to successfully import other resources just fine. I do have the latest terraform.exe file. Any suggestions on what might be causing this issue will be greatly appreciated.

Cheers

2 Likes

Did you solve this?
I am having the same…