Giter Site home page Giter Site logo

Comments (2)

Tavisca-shruti-joshi avatar Tavisca-shruti-joshi commented on June 5, 2024

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": []
}

from terracognita.

ls-spryker avatar ls-spryker commented on June 5, 2024

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

from terracognita.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.