Title
#general
r

Raushan

10/04/2022, 10:02 AM
Hi <!channel> I need help to setup bitbucket pipeline any reference will help and one more thing my tf state file is stored in S3 bucket so need reference on that regard. Thanks
g

Gurpal Singh

10/04/2022, 10:04 AM
read the docs
Andrii Benedyk

Andrii Benedyk

10/04/2022, 10:04 AM
Hi Please give more detail What kind of issues you faced during pipeline setup?
r

Raushan

10/04/2022, 10:05 AM
I have gone through doc
10:06 AM
I am not able to find references how we can use when you tfstate file in s3
Hugo (Infracost)

Hugo (Infracost)

10/04/2022, 10:08 AM
hi @Raushan, please don’t use “channel” as it notifies all the 664 people in this community, and it might be a bit alarming for other members. In regards to your question - what method of integration are you using Infracost with? Plan JSON or HCL parsing?
r

Raushan

10/04/2022, 10:09 AM
My bad, Noted @Hugo (Infracost)
i

Iliyan Vutov

10/04/2022, 10:09 AM
Also, learn how to use punctuation - it helps.
Mohammed Yahya - محمد المصدّر

Mohammed Yahya - محمد المصدّر

10/04/2022, 10:16 AM
Hey @Raushan Start with something so simple like:
infracost breakdown --path .
this will not need
state
file or S3 backend access.
10:18 AM
If everything is working, then, you can read the state file with Terraform plan:
cd path/to/code

terraform init
terraform plan -out tfplan.binary
terraform show -json tfplan.binary > plan.json

infracost breakdown --path plan.json
10:18 AM
Compare the two options, and see if you really need to use the state file for cost breakdown. 🤷
10:22 AM
https://www.infracost.io/docs/integrations is missing Bitbucket, CircleCI, and Jenkins, I’m sure the team will work on this soon. • bitbucket pipeline = infracost pipe • CircleCI = infracost orb • Jenkins = infracost Jenkinsfile
10:23 AM
but not that hard to write your own
r

Raushan

10/04/2022, 10:28 AM
Thanks @Mohammed Yahya - محمد المصدّر will check, and if i have doubt will let you know
Hugo (Infracost)

Hugo (Infracost)

10/04/2022, 10:28 AM
Thanks, @Mohammed Yahya - محمد المصدّر. Yes, we actively encourage folks to use HCL parsing by default because this doesn’t require Terraform state or cloud credentials. If, as Mohammed rightly says, you have price inconsistencies or use rely on multiple data blocks and remote state to build resources, then we recommend the Plan JSON approach. This can be built with Terraform, as Mohammed has shown. We also have an example of a bitbucket pipeline using HCL parsing here: https://bitbucket.org/infracost/infracost-bitbucket-pipeline/src/master/
Mohammed Yahya - محمد المصدّر

Mohammed Yahya - محمد المصدّر

10/04/2022, 10:31 AM
@Hugo (Infracost) Thanks for the tips, can we add
bitbucket
pipeline with the upper link to https://www.infracost.io/docs/integrations?
Hugo (Infracost)

Hugo (Infracost)

10/04/2022, 10:31 AM
yeah we should probably update that