To know how to price each resource it's good to check the AWS Price Calculator and the CSV that we use for AWS has this columns and format.
- Familiarize yourself with the official AWS pricing page for the service as well as the Terraform documentation for the resource you want to add. Note all factors that influence the cost.
- Download and familiarize yourself with the pricing data CSV. This can be done by first checking the index.json, finding the respective service under the
offers
key and downloading the file at the URL under thecurrentVersionUrl
(replacejson
withcsv
). - Find the names of all columns that contain relevant cost factors and check that the
aws/field/field.go
file contains them - add them if this is not the case and also to theaws/ingester.go
so it's categorized to the right entity (Price or Product). The constant name should be a correct Go identifier, while the comment should contain the variable name as it appears inaws/field/field.go
. - Run
make generate
to regenerate the field list. - Create a new file in the
aws/terraform
directory with the name of the Terraform resource (without theaws
prefix), e.g. foraws_db_instance
it would bedb_instance.go
. It should include two new structs:Resource
(that is an intermediate struct containing only the relevant cost factors) andresourceValues
(that directly represents the values from the Terraform resource.) Additionally, theResource
struct must implement theComponents
method that returns[]query.Component
. See the other existing resources for inspiration. - Add the terraform resource to the
aws/terraform/provider.go
on theResourceComponents
- Write tests for your resource. As before, check the other existing test files for inspiration.
- Test and make sure that estimating your resource works.
- Open a PR with the changes and please try to provide as much information as possible, especially: description of all the cost factors that the PR uses, links to Terraform docs and AWS pricing page, examples of a Terraform file and the resulting estimation.
aws_instance
aws_autoscaling_group
aws_db_instance
aws_ebs_volume
aws_efs_file_system
aws_elasticache_cluster
aws_elasticache_replication_group
aws_eip
aws_elb
aws_eks_cluster
aws_eks_node_group
aws_fsx_lustre_file_system
aws_fsx_ontap_file_system
aws_fsx_openzfs_file_system
aws_fsx_windows_file_system
aws_lb
aws_alb
aws_nat_gateway