Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws aws_alb_listener_rule condition #306

Open
joh-klein opened this issue Jun 29, 2022 · 5 comments
Open

aws aws_alb_listener_rule condition #306

joh-klein opened this issue Jun 29, 2022 · 5 comments
Labels
Type: Bug Something isn't working

Comments

@joh-klein
Copy link

General information:

  • Operating System: macOS
  • Terracognita version / tag: v0.7.6-12
  • Did you build Terracognita from sources or did you use the Docker image: homebrew

Describe the bug:
I did

terracognita aws --aws-default-region eu-central-1 --aws-access-key […] --aws-secret-access-key […] --module tst --include aws_alb_listener_rule
cd tst
terraform init
terraform plan

This is what happend:

│ Error: Insufficient condition blocks
│
│   on module-tst/elastic_load_balancing_v2_alb_nlb.tf line 122, in resource "aws_alb_listener_rule" "arn_aws_elasticloadbalancing_eu_central_1_999999999999_listener_rule_xyz_xyz_xyz_1b2n3m4n5v69x8y6_98c7x65y42j21l4j_987sdf654sdg3g6n":
│  122: resource "aws_alb_listener_rule" "arn_aws_elasticloadbalancing_eu_central_1_999999999999_listener_rule_xyz_xyz_xyz_1b2n3m4n5v69x8y6_98c7x65y42j21l4j_987sdf654sdg3g6n" {
│
│ At least 1 "condition" blocks are required.
╵
╷
│ Error: Unsupported argument
│
│   on module-tst/elastic_load_balancing_v2_alb_nlb.tf line 136, in resource "aws_alb_listener_rule" "arn_aws_elasticloadbalancing_eu_central_1_999999999999_listener_rule_xyz_xyz_xyz_1b2n3m4n5v69x8y6_98c7x65y42j21l4j_987sdf654sdg3g6n":
│  136:   condition    = var.aws_alb_listener_rule_arn_aws_elasticloadbalancing_eu_central_1_999999999999_listener_rule_xyz_xyz_xyz_1b2n3m4n5v69x8y6_98c7x65y42j21l4j_987sdf654sdg3g6n_condition
│
│ An argument named "condition" is not expected here. Did you mean to define a block of type "condition"?
╵
╷

Anything I can do?

@joh-klein joh-klein added the Type: Bug Something isn't working label Jun 29, 2022
@talset
Copy link
Member

talset commented Jun 30, 2022

I see you are exposing condition with variable. I guess there is an issue. We shouldn't allow that since you can have condition = var.foo but only blocks condition {}

With --module, I would suggest using --module-variables and defining only the expected variables (not all) like

aws_instance:
  - instance_type

@joh-klein
Copy link
Author

Thanks for your answer! It's not exactly that I am exposing the condition on purpose – I just wanted to see if the stuff that I downloaded via terracognita … is valid. I did not change anything!

@talset
Copy link
Member

talset commented Jun 30, 2022

Ok so if it is on purpose, no workaround :)

Instead of

condition    = var.aws_alb_listener_rule_arn_aws_elasticloadbalancing_eu_central_1_999999999999_listener_rule_xyz_xyz_xyz_1b2n3m4n5v69x8y6_98c7x65y42j21l4j_987sdf654sdg3g6n_condition

it should look like

  condition {
    path_pattern {
      values = var.foo_condition_path_pattern_values0
    }
  }

I know we had an issue with the incrementation like 0 (#285), but here it is not evaluated properly. I will try to reproduce it.

@talset
Copy link
Member

talset commented Jun 30, 2022

looks to be only when your rule doesn't have condition

@joh-klein
Copy link
Author

I'm not sure if I made myself clear. It says

condition    = var.aws_alb_listener_rule_arn_aws_elasticloadbalancing_eu_central_1_999999999999_listener_rule_xyz_xyz_xyz_1b2n3m4n5v69x8y6_98c7x65y42j21l4j_987sdf654sdg3g6n_condition

not because I wrote it like that but because this is the way terracognita wrote it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants