able-soccer-51632
01/05/2024, 6:30 PM├── _global
│ └── ecs_admin_ui.hcl
├── common.hcl
├── eu-west-1
│ ├── dev
│ │ ├── ecs_admin_ui
│ │ │ └── terragrunt.hcl
│ │ └── env.hcl
│ ├── prd
│ │ ├── ecs_admin_ui
│ │ │ └── terragrunt.hcl
│ │ └── env.hcl
│ ├── region.hcl
│ └── stg
│ ├── ecs_admin_ui
│ │ └── terragrunt.hcl
│ └── env.hcl
├── terragrunt.hcl
└── us-east-1
├── dev
│ ├── ecs_admin_ui
│ │ └── terragrunt.hcl
│ └── env.hcl
├── prd
│ ├── ecs_admin_ui
│ │ └── terragrunt.hcl
│ └── env.hcl
├── region.hcl
└── stg
├── ecs_admin_ui
│ └── terragrunt.hcl
└── env.hcl
If I change something on Fargete scope, such as increase the number of containers, nothing happens on the Infracost report, However, if I create another Service on Fargate, it identifies and shows the cost on reports.
My infracost.yaml
file using GitHub Actions to deploy:
name: Infracost
on: [pull_request]
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
INFRACOST_LOG_LEVEL: debug
jobs:
terraform-project:
name: Infracost
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
env:
TF_ROOT: terragrunt/
steps:
- name: add GIT_SSH_KEY
run: |
ssh-agent -a $SSH_AUTH_SOCK
mkdir -p ~/.ssh
echo "${{ secrets.TERRAFORM_MODULES_SSH_KEY }}" | tr -d '\r' | ssh-add -
ssh-keyscan <http://github.com|github.com> >> ~/.ssh/known_hosts
- name: Setup Infracost
uses: infracost/actions/setup@v2
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}
- name: Checkout base branch
uses: actions/checkout@v3
with:
ref: '${{ github.event.pull_request.base.ref }}'
- name: Generate Infracost cost estimate baseline
run: |
infracost breakdown --path=${TF_ROOT} \
--format=json \
--out-file=/tmp/infracost-base.json
- name: Checkout PR branch
uses: actions/checkout@v3
- name: Generate Infracost diff
run: |
infracost diff --path=${TF_ROOT} \
--format=json \
--compare-to=/tmp/infracost-base.json \
--out-file=/tmp/infracost.json
cat /tmp/infracost.json
- name: Post Infracost comment
run: |
infracost comment github --path=/tmp/infracost.json \
--repo=$GITHUB_REPOSITORY \
--github-token=${{github.token}} \
--pull-request=${{github.event.pull_request.number}} \
--behavior=update
crooked-daybreak-55253
01/05/2024, 6:39 PMable-soccer-51632
01/05/2024, 9:31 PMdesired_count
to 10 instead 1
inputs = {
container = {
image_uri = var.registry_url
name = "floorplan"
port = 8080
protocol = "HTTP"
cpu = 1024
memory = 2048
desired_count = 1
environment = local.app_vars
crooked-daybreak-55253
01/05/2024, 9:50 PMable-soccer-51632
01/05/2024, 10:27 PMinputs = {
container = {
image_uri = var.registry_url
name = "floorplan"
port = 8080
protocol = "HTTP"
cpu = 4096
memory = 16384
desired_count = 1
environment = local.app_vars
No changes in the cost estimation as wellable-soccer-51632
01/05/2024, 10:28 PMcrooked-daybreak-55253
01/05/2024, 10:37 PMable-soccer-51632
01/08/2024, 11:11 AMable-soccer-51632
01/08/2024, 11:12 AMable-soccer-51632
01/08/2024, 11:13 AMcrooked-daybreak-55253
01/08/2024, 12:44 PMable-soccer-51632
01/08/2024, 1:01 PMable-soccer-51632
01/08/2024, 1:01 PMcrooked-daybreak-55253
01/08/2024, 2:21 PMcrooked-daybreak-55253
01/08/2024, 2:24 PMable-soccer-51632
01/08/2024, 3:04 PMinfracost breakdown --path . --format json --out-file infracost-base.json
Changed the desired_count
from 1 to 10 and run:
infracost diff --path . --compare-to infracost-base.json
the result is always the sameable-soccer-51632
01/08/2024, 3:06 PMable-soccer-51632
01/08/2024, 3:07 PMcpu = 1024
memory = 2048
desired_count = 1
crooked-daybreak-55253
01/08/2024, 3:08 PMinfracost breakdown --path .
against the example module I get:
module.ecs_service.module.container_definition["fluent-bit"].aws_cloudwatch_log_group.this[0]
├─ Data ingested Monthly cost depends on usage: $0.50 per GB
├─ Archival Storage Monthly cost depends on usage: $0.03 per GB
└─ Insights queries data scanned Monthly cost depends on usage: $0.005 per GB
Which means there was no estimate generated (because there was no task definition).able-soccer-51632
01/08/2024, 5:37 PMName Monthly Qty Unit Monthly Cost
aws_route53_record.lb_record
├─ Standard queries (first 1B) Monthly cost depends on usage: $0.40 per 1M queries
├─ Latency based routing queries (first 1B) Monthly cost depends on usage: $0.60 per 1M queries
└─ Geo DNS queries (first 1B) Monthly cost depends on usage: $0.70 per 1M queries
module.alb.aws_lb.this[0]
├─ Application load balancer 730 hours $18.40
└─ Load balancer capacity units Monthly cost depends on usage: $5.84 per LCU
module.ecs_service.module.container_definition["admin-ui"].aws_cloudwatch_log_group.this[0]
├─ Data ingested Monthly cost depends on usage: $0.57 per GB
├─ Archival Storage Monthly cost depends on usage: $0.03 per GB
└─ Insights queries data scanned Monthly cost depends on usage: $0.0057 per GB
but the infracosts shows the same estimation value, regardless about the number of containers, the value is always the same.crooked-daybreak-55253
01/09/2024, 4:43 PMmodule.ecs_service.aws_ecs_service.this[0]
├─ Per GB per hour 2 GB $6.49
├─ Per vCPU per hour 1 CPU $29.55
└─ Inference accelerator (eia2.medium) 730 hours $87.60
able-soccer-51632
01/09/2024, 4:44 PMcrooked-daybreak-55253
01/09/2024, 4:49 PMable-soccer-51632
01/10/2024, 12:58 PMterragrunt run-all plan -out planfile
in the main branch (with 1 container) and run the same plan on my test branch (10 containers). No changes has been detected 😢crooked-daybreak-55253
01/10/2024, 1:21 PMable-soccer-51632
01/10/2024, 1:33 PM