skyscrapr / terraform-provider-cloudability

Cloudability provider for Hashicorp Terraform
MIT License
8 stars 6 forks source link

Multiple Business metric creation all assigned the same id in terraformstate file #37

Closed prabha11-sys closed 1 year ago

prabha11-sys commented 1 year ago

I updated my terraform config to create multiple business metrics. Only two metrics were created in cloudability. terraformstate file all had the same ids assigned to the business metrics creating a conflict,

resource "cloudability_business_metric" "RI_Quantity_Needed_1" { default_value_expression = "0" /default_value_expression = null/ name = "RI Quantity Needed 1" number_format = "number" pre_match_expression = null statement { match_expression = "DIMENSION['usage_type'] CONTAINS 'Virtual Machines::'" value_expression = "(METRIC['usage_hours'] - METRIC['reserved_hours']) / 24"

resource "cloudability_business_metric" "RI_Quantity_Needed_2" { default_value_expression = "0" /default_value_expression = null/ name = "RI Quantity Needed 2 " number_format = "number" pre_match_expression = null statement { match_expression = "DIMENSION['usage_type'] CONTAINS 'Virtual Machines::'" value_expression = "(METRIC['usage_hours'] - METRIC['reserved_hours']) / 24"

resource "cloudability_business_metric" "RI_Waste_1" { name = "RI Waste 1" number_format = "currency" default_value_expression = "0" statement { match_expression = "DIMENSION['lease_type'] == 'Reserved' && DIMENSION['transaction_type'] == 'Recurring Charge'" value_expression = "METRIC['total_amortized_cost']" } }

resource "cloudability_business_metric" "RI_Waste_2" { name = "RI Waste 2" number_format = "currency" default_value_expression = "0" statement { match_expression = "DIMENSION['lease_type'] == 'Reserved' && DIMENSION['transaction_type'] == 'Recurring Charge'" value_expression = "METRIC['total_amortized_cost']" } }

skyscrapr commented 1 year ago

@prabha11-sys

The business mappings endpoint cannot handle concurrent requests.

I suggest trying -parallelism=1 for now on the terraform command line.

This works for me. I would also log a ticket with Cloudability as this is a bug with the endpoint.

prabha11-sys commented 1 year ago

Thank you