I'm trying to import a aws_wafv2 web acl that I've created via the console. I setup the terraform up but for some reason it won't let me import, it says my ID is not available. Any guidance on this is greatly appreciated.
Here is my main.tf
resource "aws_wafv2_web_acl" "waf_acl_buddyman" {
name = "waf_acl_buddyman"
description = "WAF ACL for buddyman"
id = data.terraform_remote_state.aws_wafv2_web_acl.outputs.aws_wafv2_web_acl_af_acl_buddyman_id
scope = "REGIONAL"
default_action {
allow {}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "waf_acl_buddyman"
sampled_requests_enabled = true
}
rule {
name = "waf_buddyman_acl"
priority = 0
override_action {
count {}
}
statement {
managed_rule_group_statement {
name = "AWSManagedRulesCommonRuleSet"
vendor_name = "AWS"
excluded_rule {
name = "SizeRestrictions_QUERYSTRING"
}
excluded_rule {
name = "NoUserAgent_HEADER"
}
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "friendly-rule-metric-name"
sampled_requests_enabled = true
}
}
}
my output.tf looks like this:
output "aws_wafv2_web_acl_af_acl_buddyman_id" {
value = aws_wafv2_web_acl.waf_acl_buddyman.id
}
When I run terraform import aws_wafv2_web_acl.waf_acl_buddyman baf6e249-ec50-45df-ae9f-073e73f83900/waf_acl_buddyman/REGIONAL it shows:
Acquiring state lock. This may take a few moments...
aws_wafv2_web_acl.waf_acl_buddyman: Importing from ID "baf6e249-ec50-45df-ae9f-073e73f83900/waf_acl_buddyman/REGIONAL"...
aws_wafv2_web_acl.waf_acl_buddyman: Import prepared!
Prepared aws_wafv2_web_acl for import
aws_wafv2_web_acl.waf_acl_buddyman: Refreshing state... [id=baf6e249-ec50-45df-ae9f-073e73f83900]
╷
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to "aws_wafv2_web_acl.waf_acl_buddyman", 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.
╵
Releasing state lock. This may take a few moments...
Output is what Terraform module produces. But you want to take Output as input. Guess why it's empty?
How to perform import.