Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero cost for an EKS cluster with terraform-aws-modules/eks/aws #77

Closed
anthonydahanne opened this issue Sep 9, 2020 · 1 comment
Closed

Comments

@anthonydahanne
Copy link

Hello,
Using latest infracost, version 0.5.1, I tried running the following to get estimated costs for an EKS cluster created using https://github.com/terraform-aws-modules/terraform-aws-eks (it's just a couple of wrappers on top of official Terraform EKS modules, AFAIK) - but I got an empty table with a cost of 0.

TF_CLI_ARGS_plan="-var-file=variables.tfvars -var cluster_name=${CLUSTER}" infracost --tfdir .
  NAME           MONTHLY QTY  UNIT  PRICE  HOURLY COST  MONTHLY COST  

  OVERALL TOTAL                                 0.0000        0.0000  

Unfortunately, DEBUGor even TRACE logs don't help that much:

TF_CLI_ARGS_plan="-var-file=variables.tfvars -var cluster_name=${CLUSTER}" infracost --log-level=TRACE  --tfdir .
INFO Running command: /usr/bin/terraform init 
  NAME           MONTHLY QTY  UNIT  PRICE  HOURLY COST  MONTHLY COST  

  OVERALL TOTAL                                 0.0000        0.0000  

Here is the state list result on the same Terraform directory:

# terraform state list                                                            
data.aws_eks_cluster.cluster
data.aws_eks_cluster_auth.cluster
data.aws_region.current
kubernetes_cluster_role.cluster_autoscaler
kubernetes_cluster_role_binding.cluster_autoscaler
kubernetes_deployment.cluster_autoscaler
kubernetes_role.cluster_autoscaler
kubernetes_role_binding.cluster_autoscaler
kubernetes_service_account.cluster_autoscaler
module.datasource.data.aws_caller_identity.current
module.datasource.data.aws_region.current
module.datasource.data.aws_security_group.eks-entrypoints
module.datasource.data.aws_subnet_ids.subnets
module.datasource.data.aws_vpc.shared_vpc
module.eks.data.aws_ami.eks_worker
module.eks.data.aws_ami.eks_worker_windows
module.eks.data.aws_caller_identity.current
module.eks.data.aws_iam_policy_document.cluster_assume_role_policy
module.eks.data.aws_iam_policy_document.workers_assume_role_policy
module.eks.data.aws_iam_role.custom_cluster_iam_role[0]
module.eks.data.aws_partition.current
module.eks.data.null_data_source.node_groups[0]
module.eks.aws_eks_cluster.this[0]
module.eks.local_file.kubeconfig[0]
module.eks.module.node_groups.aws_eks_node_group.workers["my-node"]
module.eks.module.node_groups.random_pet.node_groups["my-node"]

Interestingly enough, if I add a t2.micro, I'm gonna get some results:

resource "aws_instance" "example" {
  ami           = "ami-0e7767d1cb89be85d"
  instance_type = "t2.micro"
}
TF_CLI_ARGS_plan="-var-file=variables.tfvars -var cluster_name=${CLUSTER}" infracost --log-level=TRACE  --tfdir .
INFO Running command: /usr/bin/terraform init 
  NAME                              MONTHLY QTY  UNIT       PRICE   HOURLY COST  MONTHLY COST  

  aws_instance.example                                                                         
  ├─ Compute (on-demand, t2.micro)          730  hours      0.0116       0.0116        8.4680  
  └─ Storage (root_block_device)              8  GB-months  0.1000       0.0011        0.8000  
  Total                                                                  0.0127        9.2680  
                                                                                               
  OVERALL TOTAL                                                          0.0127        9.2680  

So all in all, I'm wondering if infracostcan estimate EKS costs ?

Looking at the GraphQL API (https://pricing.infracost.io/graphql) I can see EKS is there though:

query {
  products(
    filter: {
      vendorName: "aws",
      service: "AmazonEKS",
      region: "ca-central-1"
    },
  ) {
    attributes { key, value }
    prices { USD }
  }
}

will return

{
  "data": {
    "products": [
      {
        "attributes": [
          {
            "key": "servicecode",
            "value": "AmazonEKS"
          },
          {
            "key": "location",
            "value": "Canada (Central)"
          },
          {
            "key": "locationType",
            "value": "AWS Region"
          },
          {
            "key": "usagetype",
            "value": "CAN1-AmazonEKS-Hours:perCluster"
          },
          {
            "key": "operation",
            "value": "CreateOperation"
          },
          {
            "key": "servicename",
            "value": "Amazon Elastic Container Service for Kubernetes"
          },
          {
            "key": "tiertype",
            "value": "HAStandard"
          }
        ],
        "prices": [
          {
            "USD": "0.1000000000"
          }
        ]
      }
    ]
  }
}

Thanks for your help!

@aliscott
Copy link
Member

aliscott commented Sep 9, 2020

Thanks @anthonydahanne! Currently infracost doesn't support EKS - see https://www.infracost.io/docs/supported_resources for all currently support resources. I've added an issue for EKS here: #82.

@aliscott aliscott closed this as completed Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants