Lizzie
Lizzie

Reputation: 351

"missing value for command" error in terraform code

I see the following error while executing terraform plan. If I delete the .terraform* files, terraform plan works. If I run terraform apply after this, terraform apply again fails with the same error.

Planning failed. Terraform encountered an error while generating this plan.

│ Error: template: .terraform/providers/registry.terraform.io/akamai/akamai/6.0.0/darwin_amd64/terraform-provider-akamai_v6.0.0:70761: missing value for command
│ 
│   with data.akamai_property_rules_template.rules,
│   on akamai.tf line 54, in data "akamai_property_rules_template" "rules":
│   54: data "akamai_property_rules_template" "rules" {

This is my code.

data "akamai_property_rules_template" "rules" {
  template_file = abspath("${path.root}/property-rules.json")
  variables {
    name = "directory_name"
    value = var.directory_name
    type = "string"
  }
}

property-rules.json

{
  "rules": {
    "name": "default",
    "behaviors": [
      {
        "name": "origin",
        "options": {
          "originType": "NET_STORAGE",
          "netStorage": {
            "cpCode": 1111111,
            "downloadDomainName": "testnsx.download.akamai.com",
            "name": "TestNSx",
            "id": 0000000
          }
        }
      },
      {
        "name": "allowPost",
        "options": {
          "allowWithoutContentLength": false,
          "enabled": false
        }
      },
      {
        "name": "caching",
        "options": {
          "behavior": "MAX_AGE"
        }
      }
    ],
    "variables": [
      {
        "name": "PMUSER_DIR",
        "value": "${env.directory_name}",
        "description": "Main content directory",
        "hidden": false,
        "sensitive": false
      },
      {
        "name": "PMUSER_FORCE_HTTPS",
        "value": "Y",
        "description": "Force secure connection",
        "hidden": false,
        "sensitive": false
      }
    ],
    "comments": "The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings."
  }
}

Any suggestions on how this could be fixed?

Upvotes: -1

Views: 180

Answers (1)

Sheila Kearney
Sheila Kearney

Reputation: 1

I work within the Akamai Terraform team.

The error states the rules are missing a required argument. Check your JSON file against the requirements. If you're still having issues, please open an issue in our Terraform provider repo.

Upvotes: 0

Related Questions