terraform-provider-ovh icon indicating copy to clipboard operation
terraform-provider-ovh copied to clipboard

Using custom ISO 8601 payment duration fails

Open khaledavarteq opened this issue 3 years ago • 0 comments

Hello,

while trying to create a new Terraform module to manage an ovh_cloud_project resource, we ran into an issue:

Terraform Version

Terraform v1.0.5 on darwin_amd64

  • provider registry.terraform.io/hashicorp/helm v2.3.0
  • provider registry.terraform.io/hashicorp/kubernetes v2.6.1
  • provider registry.terraform.io/hashicorp/local v2.1.0
  • provider registry.terraform.io/ovh/ovh v0.16.0
  • provider registry.terraform.io/terraform-provider-openstack/openstack v1.44.0

Affected Resource(s)

  • ovh_cloud_project

Terraform Configuration Files

data "ovh_order_cart" "cart" {
  ovh_subsidiary = "fr"
  description    = "Use the French OVH cart by default"
}

data "ovh_order_cart_product_plan" "cloud" {
  cart_id        = data.ovh_order_cart.cart.id
  price_capacity = "renew"
  product        = "cloud"
  plan_code      = "project.2018"
}

resource "ovh_cloud_project" "cloud" {
  ovh_subsidiary = data.ovh_order_cart.cart.ovh_subsidiary
  description    = var.project_description
  payment_mean   = "fidelity"

  plan {
    duration     = "PT1H"
    plan_code    = data.ovh_order_cart_product_plan.cloud.plan_code
    pricing_mode = data.ovh_order_cart_product_plan.cloud.selected_price.0.pricing_mode
  }
}

Debug Output

module.ovh_cloud.ovh_cloud_project.cloud: Creating...

│ Error: Could not order cloud project: "calling Post /order/cart/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/cloud with params %!v(PANIC=String method: runtime error: invalid memory address or nil pointer dereference):\n\t \"Error 500: \\\"Internal server error\\\"\""
│ 
│   with module.ovh_cloud.ovh_cloud_project.cloud,
│   on .terraform/modules/ovh_cloud/main.tf line 1, in resource "ovh_cloud_project" "cloud":
│    1: resource "ovh_cloud_project" "cloud" {

Expected Behavior

A new cloud project should be created with the payment period set to "1 hour" or "hourly".

Actual Behavior

Terraform does not create a new cloud project and aborts with the above error message.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

The above code is very similar to the documentation for the resource ovh_cloud_project and yet the above error is returned. We have added a valid payment method and manually creating a cloud project works. We can also use the manually created cloud project's ID in other Terraform code without issue.

khaledavarteq avatar Oct 29 '21 08:10 khaledavarteq