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

data aws_pricing_instance #5009

Closed
julienduchesne opened this issue Jun 27, 2018 · 7 comments · Fixed by #5057
Closed

data aws_pricing_instance #5009

julienduchesne opened this issue Jun 27, 2018 · 7 comments · Fixed by #5057
Labels
new-data-source Introduces a new data source. service/pricing Issues and PRs that pertain to the pricing service.
Milestone

Comments

@julienduchesne
Copy link
Contributor

julienduchesne commented Jun 27, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Hi, I currently have a python script that retrieves the on-demand price of an ec2 instance with the pricing api that I'd like to use in a terraform context (setting a spot_price that is a fraction of on-demand). It has the following parameters: instance_type string, region string, os string (linux or windows). Would this be an appropriate feature for terraform? I'd implement it myself.

New or Affected Resource(s)

  • aws_pricing_instance

Potential Terraform Configuration

data "aws_pricing_ec2_instance" "launch_config_1" {
  region = "us-east-1"
  instance_type = "c5.large"
  os = "LINUX"
}
resource "aws_launch_configuration" "launch_config_1" {
  name_prefix          = "Cluster"
  image_id             = "..."
  instance_type        = "c5.large"
  spot_price           = "${data.aws_pricing_instance.launch_config_1.hourly * 0.5}"
  user_data            = "..."
  key_name             = "..."
  iam_instance_profile = "..."
  security_groups      = ["..."]
}
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. new-data-source Introduces a new data source. labels Jun 27, 2018
@bflad
Copy link
Contributor

bflad commented Jun 28, 2018

From a maintainability standpoint, we may want to consider implementing this with the generic filtering as there are a lot of dimensions associated even with only the AmazonEC2 service code:

$ aws --region us-east-1 pricing describe-services --service-code amazonec2
{
    "Services": [
        {
            "ServiceCode": "AmazonEC2",
            "AttributeNames": [
                "volumeType",
                "maxIopsvolume",
                "instance",
                "instanceCapacity10xlarge",
                "locationType",
                "instanceFamily",
                "operatingSystem",
                "clockSpeed",
                "LeaseContractLength",
                "ecu",
                "networkPerformance",
                "instanceCapacity8xlarge",
                "group",
                "maxThroughputvolume",
                "gpuMemory",
                "ebsOptimized",
                "elasticGpuType",
                "maxVolumeSize",
                "gpu",
                "processorFeatures",
                "intelAvxAvailable",
                "instanceCapacity4xlarge",
                "servicecode",
                "groupDescription",
                "processorArchitecture",
                "physicalCores",
                "productFamily",
                "enhancedNetworkingSupported",
                "intelTurboAvailable",
                "memory",
                "dedicatedEbsThroughput",
                "vcpu",
                "OfferingClass",
                "instanceCapacityLarge",
                "capacitystatus",
                "termType",
                "storage",
                "intelAvx2Available",
                "storageMedia",
                "physicalProcessor",
                "provisioned",
                "servicename",
                "PurchaseOption",
                "instanceCapacity18xlarge",
                "instanceType",
                "tenancy",
                "usagetype",
                "normalizationSizeFactor",
                "instanceCapacity2xlarge",
                "instanceCapacity16xlarge",
                "maxIopsBurstPerformance",
                "instanceCapacity12xlarge",
                "instanceCapacity32xlarge",
                "instanceCapacityXlarge",
                "licenseModel",
                "currentGeneration",
                "preInstalledSw",
                "location",
                "instanceCapacity24xlarge",
                "instanceCapacity9xlarge",
                "instanceCapacityMedium",
                "operation"
            ]
        }
    ],
    "FormatVersion": "aws_v1"
}

@julienduchesne
Copy link
Contributor Author

What about a generic product resource and a more precise one that uses the other ones methods. From a usability standpoint, generic filtering is so-so. I was going to implement a few of the more important attributes such as tenancy.

@bflad
Copy link
Contributor

bflad commented Jun 28, 2018

I was going to implement a few of the more important attributes such as tenancy.

I would personally worry that everyone's definition of important might be different. That's not to say we would never accept something very targeted for a specific use case, but in the end it might just turn into implementing everything, which seems like a large burden.

Implementing the generic resource allows us to provide the customizable building block for others to build Terraform modules on top of the functionality if they so desire, rather than this project needing to worry about all the use cases.

@julienduchesne
Copy link
Contributor Author

Alright, I understand what you mean. I'll try to figure out a simple way to manipulate the API in a generic way.

@bflad bflad added service/pricing Issues and PRs that pertain to the pricing service. and removed enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jun 28, 2018
@bflad bflad added this to the v1.26.0 milestone Jul 4, 2018
@bflad
Copy link
Contributor

bflad commented Jul 4, 2018

A new aws_pricing_product data source has been merged into master via #5057 and will release with version 1.26.0 of the AWS provider, likely tonight or tomorrow.

@bflad
Copy link
Contributor

bflad commented Jul 4, 2018

This has been released in version 1.26.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source. service/pricing Issues and PRs that pertain to the pricing service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants