Skip to content

data aws_pricing_instance #5009

Closed
Closed
@julienduchesne

Description

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      = ["..."]
}

Metadata

Assignees

No one assigned

    Labels

    new-data-sourceIntroduces a new data source.service/pricingIssues and PRs that pertain to the pricing service.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions