Comments (4)
@seksham thanks for reporting 🙏 I need to discuss more with the team what we do to resolve this. It seems to be something that changed with how we autodetect variable files. In the meantime adding a --terraform-var 'location=eastus'
flag should resolve this for you.
from infracost.
Thanks, @aliscott , for your input. After specifying location=eastus
, I indeed began receiving pricing data. However, the calculated prices appear to be inaccurate. It includes costs for resources that shouldn't incur charges, notably module.node_pools["cas"].azurerm_kubernetes_cluster_node_pool.static_node_pool[0]
. According to the Terraform plan, node_count
for this resource is 0, indicating it shouldn't be charged. Versions prior to 10.32 displayed the correct pricing.
Here's the output I received:
infracost2 breakdown --path . --show-skipped --fields all --terraform-var 'prefix=abcd' --terraform-var 'location=eastus'
Evaluating Terraform directory at .
✔ Downloading Terraform modules
✔ Evaluating Terraform directory
✔ Retrieving cloud prices to calculate costs
Project: project_672bf4gt
Name Price Monthly Qty Unit Hourly Cost Monthly Cost
module.aks.azurerm_kubernetes_cluster.aks
├─ default_node_pool
│ ├─ Instance usage (Linux, pay as you go, Standard_D8s_v4) $0.38 1,460 hours $0.77 $560.64
│ └─ os_disk
│ └─ Storage (P10, LRS) $19.71 2 months $0.05 $39.42
└─ Load Balancer
└─ Data processed Monthly cost depends on usage: $0.005 per GB
module.flex_postgresql["default"].azurerm_postgresql_flexible_server.flexpsql
├─ Compute (GP_Standard_D16s_v3) $1.37 730 hours $1.37 $998.64
├─ Storage $0.12 64 GB $0.01 $7.36
└─ Additional backup storage Monthly cost depends on usage: $0.095 per GB
module.jump[0].azurerm_linux_virtual_machine.vm
├─ Instance usage (Linux, pay as you go, Standard_B2s) $0.0416 730 hours $0.04 $30.37
└─ os_disk
├─ Storage (S6, LRS) $3.01 1 months $0.00 $3.01
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations
module.jump[0].azurerm_public_ip.vm_ip[0]
└─ IP address (static) $0.0036 730 hours $0.00 $2.63
module.nfs[0].azurerm_linux_virtual_machine.vm
├─ Instance usage (Linux, pay as you go, Standard_D8s_v4) $0.38 730 hours $0.38 $280.32
└─ os_disk
├─ Storage (S6, LRS) $3.01 1 months $0.00 $3.01
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations
module.nfs[0].azurerm_managed_disk.vm_data_disk[0]
├─ Storage (S10, LRS) $5.89 1 months $0.01 $5.89
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations
module.nfs[0].azurerm_managed_disk.vm_data_disk[1]
├─ Storage (S10, LRS) $5.89 1 months $0.01 $5.89
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations
module.nfs[0].azurerm_managed_disk.vm_data_disk[2]
├─ Storage (S10, LRS) $5.89 1 months $0.01 $5.89
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations
module.nfs[0].azurerm_managed_disk.vm_data_disk[3]
├─ Storage (S10, LRS) $5.89 1 months $0.01 $5.89
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations
module.node_pools["cas"].azurerm_kubernetes_cluster_node_pool.static_node_pool[0]
├─ Instance usage (Linux, pay as you go, Standard_E16s_v3) $1.01 730 hours $1.01 $735.84
└─ os_disk
└─ Storage (P15, LRS) $38.01 1 months $0.05 $38.01
module.node_pools["compute"].azurerm_kubernetes_cluster_node_pool.static_node_pool[0]
├─ Instance usage (Linux, pay as you go, Standard_E16s_v3) $1.01 730 hours $1.01 $735.84
└─ os_disk
└─ Storage (P15, LRS) $38.01 1 months $0.05 $38.01
module.node_pools["stateful"].azurerm_kubernetes_cluster_node_pool.autoscale_node_pool[0]
├─ Instance usage (Linux, pay as you go, Standard_D8s_v3) $0.38 730 hours $0.38 $280.32
└─ os_disk
└─ Storage (P15, LRS) $38.01 1 months $0.05 $38.01
module.node_pools["stateless"].azurerm_kubernetes_cluster_node_pool.autoscale_node_pool[0]
├─ Instance usage (Linux, pay as you go, Standard_D16s_v3) $0.77 730 hours $0.77 $560.64
└─ os_disk
└─ Storage (P15, LRS) $38.01 1 months $0.05 $38.01
OVERALL TOTAL $4,413.63
──────────────────────────────────
24 cloud resources were detected:
∙ 13 were estimated, 12 of which include usage-based costs, see https://infracost.io/usage-file
∙ 11 were free:
∙ 4 x azurerm_virtual_machine_data_disk_attachment
∙ 2 x azurerm_network_interface
∙ 2 x azurerm_network_interface_security_group_association
∙ 1 x azurerm_postgresql_flexible_server_configuration
∙ 1 x azurerm_postgresql_flexible_server_firewall_rule
∙ 1 x azurerm_proximity_placement_group
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Project ┃ Monthly cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
┃ project_672bf4gt ┃ $4,414 ┃
This includes pricing for resources that, due to their configuration, should not contribute to the overall cost, contradicting expectations set by the Terraform plan.
Correct total cost should be - $1,417
from infracost.
@seksham this looks like the same issue. The problem is we're detecting variable values from the tfvar
files in the repo and some of them have min_node = 1
.
I can work round this by manually specifying which variables to use for the project, e.g:
infracost breakdown --terraform-var-file=examples/sample-input-minimal.tfvars --terraform-var="location=eastus"
We will work out what we do about this case.
from infracost.
@aliscott
I ran the above command, but I still see the price for node_pools with min_nodes = 0. The file sample-input-minimal.tfvars has 2 node pools - cas and generic, both with min_nodes set to 0, yet I still see the price for both.
I tested a simple independent Terraform configuration using just the azurerm_kubernetes_cluster_node_pool resource, with no tfvars in the project. Even for those, we are seeing the price for a 0 node_count.
provider "azurerm" {
features {}
}
resource "azurerm_kubernetes_cluster_node_pool" "autoscale_node_pool" {
name = "cas"
kubernetes_cluster_id = "" # Make sure to replace this with your AKS cluster's ID
vm_size = "Standard_E16s_v3"
enable_auto_scaling = true
min_count = 0
max_count = 5
node_count = 0
os_disk_size_gb = 200
os_disk_type = "Managed"
os_type = "Linux"
max_pods = 110
mode = "User"
orchestrator_version = "1.27"
priority = "Regular"
scale_down_mode = "Delete"
spot_max_price = -1
ultra_ssd_enabled = false
zones = ["1"]
node_labels = {
"workload.sas.com/class" = "cas"
}
node_taints = [
"workload.sas.com/class=cas:NoSchedule",
]
}
# Note: Replace var.kubernetes_cluster_id with your actual AKS cluster ID.
# You can define it in your variables file (variables.tf) or pass it directly.
Output -
Evaluating Terraform directory at .
✔ Downloading Terraform modules
✔ Evaluating Terraform directory
✔ Retrieving cloud prices to calculate costs
Project: project_zzipd67f
Name Price Monthly Qty Unit Hourly Cost Monthly Cost
azurerm_kubernetes_cluster_node_pool.autoscale_node_pool
├─ Instance usage (Linux, pay as you go, Standard_E16s_v3) $1.01 730 hours $1.01 $735.84
└─ os_disk
└─ Storage (P15, LRS) $38.01 1 months $0.05 $38.01
OVERALL TOTAL $773.85
──────────────────────────────────
1 cloud resource was detected:
∙ 1 was estimated, it includes usage-based costs, see https://infracost.io/usage-file
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Project ┃ Monthly cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
┃ project_zzipd67f ┃ $774 ┃
from infracost.
Related Issues (20)
- Custom GitHub comment or add image
- Support Azure Repos active comment thread
- Infracost integration with GitHub Actions doesn't display cost estimation in PR comments HOT 1
- Add support for some SES and SESv2 resources HOT 1
- infracost is not fetching variables defined in Terraform Enterprise HOT 1
- Missing cost for ECS Service when task definition is used from a module and "family:revision" is used instead of "arn" or "family"
- Breakdown timing after 0.10.32+ HOT 1
- Error Generating Breakdown with v0.10.35 HOT 9
- `--debug-report` flag throws an error
- Missing cost estimate for `azurerm_postgresql_flexible_server` compute GP_Standard_D2ds_v5 HOT 3
- Will Infracost work or support OpenTofu? HOT 1
- Add support for `aws_servicecatalog_product`
- New `terraform test` support for variables in run block causes module evaluation to fail HOT 2
- Comment only when costs change HOT 1
- Infracost fails to display ecs service costs when using `terraform-aws-ecs` module
- Add support for Opensearch Serverless collections: aws_opensearchserverless_collection
- Failed calculating breakdown cost of google_compute_region_instance_group_manager HOT 4
- Changes in tfvars aren't properly detected in github app HOT 2
- aws ebs unit price is not correct HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infracost.