Open Tavisca-Praveen-Kumar opened 5 months ago
I am also facing the same issue, the tag filter does not seem to work. It returns all the resources, despite passing the tag. I have double checked the tag key name and its value. Here is my output:
terracognita aws --aws-profile default --module route53record --tags Name:wwwpoc.net --tfstate terraform.tfstate --aws-default-region us-east-1
We are about to remove all content from "route53record", are you sure? Yes/No (Y/N):
Y
Starting Terracognita with version v0.8.4
Importing with filters:
Tags: [{Name wwwpoc.net}],
Include: [],
Exclude: [],
Targets: [],
Importing aws_alb_target_group [5/5] Done!
Importing aws_api_gateway_deployment [55/83]^C
If I try to include a certain resource type along with the tags, it says importing 31 resources but gives an empty state file like so:
$ terracognita aws --aws-profile default --module route53record --tags Name:wwwpoc.net --tfstate terraform.tfstate --aws-default-region us-east-1 --include aws_route53_record
We are about to remove all content from "route53record", are you sure? Yes/No (Y/N):
Y
Starting Terracognita with version v0.8.4
Importing with filters:
Tags: [{Name wwwpoc.net}],
Include: [aws_route53_record],
Exclude: [],
Targets: [],
Importing aws_route53_record [31/31] Done!
Writing HCL Done!
Writing TFState Done!
sh-4.2$ cat terraform.tfstate
{
"version": 4,
"terraform_version": "1.1.9",
"serial": 0,
"lineage": "e0041f14-403e-ee66-132a-2a99897dd5be",
"outputs": {},
"resources": []
}
I think it works as intended, just the output is misleading, eg. for lambda, where only one of 32 functions has tag clickops:yes
.
terracognita aws --include aws_lambda_function --tfstate temp.json --hcl lambda_generated --tags 'clickops:yes'
terracognita aws --include aws_lambda_function --hcl lambda_generated --tags 'clickops:yes' --tfstate temp.json
We are about to remove all content from "lambda_generated", are you sure? Yes/No (Y/N):
y
Starting Terracognita with version v0.8.4
Importing with filters:
Tags: [{clickops yes}],
Include: [aws_lambda_function],
Exclude: [],
Targets: [],
Importing aws_lambda_function [32/32] Done!
Writing HCL Done!
cat temp.json | jq .resources | jq length
1
grep resource lambda_generated/*.hcl | wc -l
1
General information: As per requirement, I just want to import one role out of all the role present in aws account
A clear and concise description of what the bug is. why it is importing all the roles present in the account. Since I only want to filter on basis of tag attached in it?