This message was deleted.
# general
b
This message was deleted.
👋 2
👀 1
l
Hi Anita, let me look through this and see what the issue might be.
@acceptable-hospital-67122 yeah, it looks like it’s having issues finding task definition. Do you have any example HCL code that we could use to try reproducing it? It might be since it’s in a different repo then our HCL parsing can’t find it to generate the costs. So one thing you could try just now is generating a plan JSON and running that through Infracost.Something like this:
Copy code
terraform plan -json -out tfplan.binary
terraform show -json tfplan.binary > plan.json
infracost breakdown --path plan.json --show-skipped
a
that is actually the first thing I tried and doesn't produce any costs either, unfortunately
🙌 1
I can try to get some sample code
l
Ah okay, thank you 🙏
a
gonna be later tonight, I think, as I need to finish something else first 🙈
l
ok no worries simple smile - thanks for helping with this, hope you get everything done!
a
@little-author-61621 I was able to reproduce this and made a sample in https://github.com/anitakrueger/infracost-test It comes down to infracost not being able to make the link between the ecs service and the task definition when the task definition is in a module and the
task_definition
parameter is set to the
family
instead of the
arn
. This does seem to work when the task definition and ecs service are in the same terraform. Then switching to the family, infracost can still make the link. In our case we set the task definition as
family
because we want the latest revision in terraform. Essentially the issue is described here: https://github.com/hashicorp/terraform-provider-aws/issues/632
l
Thanks @acceptable-hospital-67122 🙌, that investigation is incredibly helpful - I think we should be able to fix this case, so let me have a look tomorrow and see if we can get that in for the next release.
a
I think the sauce is going to be in the debug log:
Copy code
time="2022-07-27T00:54:03+01:00" level=debug routine=15 project_name= provider=terraform_dir block_name=module.task.aws_ecs_task_definition.task project_path=. attribute_name=memory msg="could not create references for expression type: &{{{{{} %!s(cty.primitiveTypeKind=78)}} %!s(*big.Float=&{512 0 0 1 false [9223372036854775808] 10})} modules/task-def/main.tf:6,30-33}"
time="2022-07-27T00:54:03+01:00" level=debug provider=terraform_dir block_name=module.task.aws_ecs_task_definition.task project_path=. attribute_name=id routine=15 project_name= msg="could not create references for expression type: &{{{{{} %!s(cty.primitiveTypeKind=83)}} 61f3e378-ae79-4cc0-b41c-d3430a90ad3e} :0,0-0}"
time="2022-07-27T00:54:03+01:00" level=debug block_name=module.task.aws_ecs_task_definition.task project_path=. routine=15 project_name= provider=terraform_dir attribute_name=arn msg="could not create references for expression type: &{{{{{} %!s(cty.primitiveTypeKind=83)}} arn:aws:hcl::4606465e-883c-4faf-987a-e6d71fb48652} :0,0-0}"
time="2022-07-27T00:54:03+01:00" level=debug provider=terraform_dir block_name=module.task.aws_ecs_task_definition.task attribute_name=cpu project_path=. routine=15 project_name= msg="could not create references for expression type: &{{{{{} %!s(cty.primitiveTypeKind=78)}} %!s(*big.Float=&{512 0 0 1 false [9223372036854775808] 9})} modules/task-def/main.tf:5,30-33}"
Do you want me to open a github issue for this?
l
Yeah that could be good - would help others if they have the issue
a
ok
l
I’m just looking at it just now to see if it’s a quick fix
a
ok
thank you for taking a look!
l
Thanks, I think I’ve found a fix that works with your use-case (
family
only), but something that works with
family:revision
will be a little more difficult with how the code works currently. I’ll finish up some tests, push the current fix to a branch and comment on the issue. If you’re able to test it on your full project that would be great as well. I can either send you the branch name once it’s pushed or create a dev build of infracost for you if you let me know which OS you are using.
a
I'm on Mac 12.2.1 atm
l
intel or ARM?
a
arm
l
I’m jealous!
a
company bought it 🙈
l
yeah, every other Infracost dev has an ARM ones and I’m jealous of their build times.
@acceptable-hospital-67122 here’s a build if you could try it:
Copy code
curl -o /tmp/infracost <https://infracost-public-dumps.s3.amazonaws.com/builds/1915/infracost-darwin-arm64>
chmod +x /tmp/infracost

/tmp/infracost breakdown ...
👀 1
a
🦜
works with using
family
but not with
family:revision
like you said
l
Are you using
family:revision
?
a
no
but it's a valid option in terraform
l
yep, that’s going to be more difficult so we’ll at least ship this as an incremental improvement.
a
well, we were using
family:revision
originally, but since have revisited that because of the issue that we update the service from an external source after it has been created
ok
that sounds good to me!
thank you so much for looking into this!!
l
np, I’ve got something on just now, but when I’m back I’ll finalise the PR and update your issue with the details of what is fixed and what isn’t. Then hopefully this will make it into the v0.10.9 release which should be out by early next week.
a
wow, awesome