millions-plumber-38090
03/03/2023, 8:13 AMterraform plan -var 'geo=us' -var 'environment=ecos'
How can we build this into our pull requests to say env ecos cost X, env qa2 cost X, prod1 will cost X.mysterious-teacher-68276
03/03/2023, 8:50 AMversion: 0.1
projects:
- path: path/to/your/project
name: ecos
env:
environment: ecos
geo: us
- path: path/to/your/project
name: prod
env:
environment: prod
geo: eu
Then it would be a matter of pointing infracost to that config file, e.g.
infracost breakdown --config-file infracost.yml
But, if you’re using GitHub as your repository, I’d recommend using our GitHub app to run your POC with. It’s much easier to iterate on an means you don’t have to define loads of boilerplate in your Azure pipelines.
Hope this helpsmillions-plumber-38090
03/03/2023, 8:51 AMmysterious-teacher-68276
03/03/2023, 8:51 AMmillions-plumber-38090
03/03/2023, 10:39 AMfatal: could not read Password for '<https://OrgName@dev.azure.com>': terminal prompts disabled
I am using the example provided here (https://github.com/infracost/infracost-azure-devops/tree/master/examples/multi-project-config-file) I copied and pasted as suggested by the documentation. I did also add the following in as suggested by some people.
- checkout: self
persistCredentials: true
mysterious-teacher-68276
03/03/2023, 10:42 AMmillions-plumber-38090
03/03/2023, 10:42 AMmysterious-teacher-68276
03/03/2023, 10:42 AMinfracost comment
command look like?millions-plumber-38090
03/03/2023, 10:43 AMmysterious-teacher-68276
03/03/2023, 10:43 AMgithub
millions-plumber-38090
03/03/2023, 10:43 AMmysterious-teacher-68276
03/03/2023, 10:43 AMinfracost comment azure-repos --repo-url <https://dev.azure.com/my-org/my-project/_git/my-repo> --pull-request 3 --path infracost.json --behavior new --azure-access-token $AZURE_ACCESS_TOKEN
millions-plumber-38090
03/03/2023, 10:44 AMmysterious-teacher-68276
03/03/2023, 10:46 AM# Clone the base branch of the pull request (e.g. main/master) into a temp directory.
- bash: |
branch=$(System.PullRequest.TargetBranch)
branch=${branch#refs/heads/}
git clone $(Build.Repository.Uri) --branch=${branch} --single-branch /tmp/base
displayName: Checkout base branch
- checkout: self
persistCredentials: true
as the first step in the pipeline?Grant version control permissions to the build service.
1. Go to project settings --> Repositories menu --> Your repository --> Security tab, and grant the following permissions to theidentity:Project Collection Build Service ({your organization})
◦ Create branch: Allow
◦ Contribute: Allow
◦ Read: Allow
◦ Create tag: Allow
millions-plumber-38090
03/03/2023, 10:55 AM--config http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)
Sorry- path: env
include_all_paths: true # include root and non-root modules
name: POD - DELP
env:
environment: delp
geo: us
purpose: devqa
To
- path: env
include_all_paths: true # include root and non-root modules
name: POD - DELP
terraform_vars:
environment: delp
geo: us
purpose: devqa
Now when the PR build runs, it shows the error of
Error: The pull request comment was generated successfully but could not be posted:
Error creating comment: 400 Bad Request
When I run the CLI locally on the new terraform_vars it works fine.mysterious-teacher-68276
03/03/2023, 1:57 PMterraform_vars
change? I don’t think changing these parameters would have any affect on the comment posting logic?millions-plumber-38090
03/03/2023, 1:58 PMmysterious-teacher-68276
03/03/2023, 1:59 PMmillions-plumber-38090
03/03/2023, 1:59 PM- path: env
include_all_paths: true # include root and non-root modules
name: POD - DELP
env:
environment: delp
geo: us
purpose: devqa
mysterious-teacher-68276
03/03/2023, 2:00 PMmillions-plumber-38090
03/03/2023, 2:00 PMmysterious-teacher-68276
03/03/2023, 2:00 PMmillions-plumber-38090
03/03/2023, 2:01 PMmysterious-teacher-68276
03/03/2023, 2:03 PMmillions-plumber-38090
03/03/2023, 2:09 PMmysterious-teacher-68276
03/03/2023, 2:09 PMmillions-plumber-38090
03/03/2023, 2:27 PMazurerm_windows_function_app
and
azurerm_route_table
mysterious-teacher-68276
03/03/2023, 2:27 PM