akamai / terraform-provider-akamai

Terraform Akamai provider

Home Page:https://www.terraform.io/docs/providers/akamai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no clean hcl to describe image and video manager policies

fkieling opened this issue · comments

Hi there,

Terraform Version

Terraform v1.5.3
on darwin_arm64

Affected Resource(s)

  • akamai_imaging_policy_image
  • akamai_imaging_policy_video

Terraform Configuration Files

resource "akamai_imaging_policy_image" "policy_for_my_images" {
  policy_id              = "for_my_images"
  contract_id            = "ctr_X-XXXXXX"
  policyset_id           = akamai_imaging_policy_set.policyset.id
  activate_on_production = true
  json                   = file("for_my_images.json")
}

for_my_images.json:

{
  "breakpoints": {
    "widths": [
      400,
      650,
      850,
      1010
    ]
  },
  "output": {
    "adaptiveQuality": 50
  }
}

Expected Behavior

No json data structure will be use to define image manager or video manager terraform definitions. All definitions will be written in HCL.

Actual Behavior

Some of the declarative terraform configuration must be define in json data structure. This way is ok. But it is more understandable if there is no break here.

Hello,

For more than a year it is possible to define policy using HCL syntax. Your example should look like

resource "akamai_imaging_policy_image" "policy_for_my_images" {
  policy_id              = "for_my_images"
  contract_id            = "ctr_X-XXXXXX"
  policyset_id           = akamai_imaging_policy_set.policyset.id
  activate_on_production = true
  json                   = data.akamai_imaging_policy_image.data_policy__auto.json

}

data "akamai_imaging_policy_image" "data_policy__auto" {
  policy {
    breakpoints {
      widths = [400, 650, 850, 1010]
    }
    output {
      adaptive_quality = "mediumHigh"
    }
  }
}