Skip to content

Error when planning against an imported existing resource: insufficient items for attribute "domain" #183

@goodspark

Description

@goodspark

Terraform Version

Terraform v0.12.6
+ provider.fastly v0.8.1

Affected Resource(s)

  • fastly_service_v1

Terraform Configuration Files

provider "fastly" {
  # I have the API key in my env vars
}

resource "fastly_service_v1" "spark_test" {
  name = "spark-test.xxxx.com"

  domain {
    name    = "spark-test.xxxx.com"
    comment = "spark testing"
  }
}

Debug Output

https://gist.github.com/goodspark/d24547bfc067823c5d63f71cf53664a9

Expected Behavior

A plan output with no changes.

Actual Behavior

Error message: insufficient items for attribute "domain"; must have at least 1

Steps to Reproduce

  1. Create a new service manually in Fastly
  2. Add a single domain and nothing else
  3. Import this service into your local terraform state for the above HCL
  4. Run 'terraform plan'

Important Factoids

  • Here's a screenshot of my Fastly service config. It's very minimal - I just wanted to first verify I could import an existing service.
    Screenshot from 2019-08-01 16-34-11

  • If I remove the existing service from my local state and run plan, it's successful.

  • But what I want to do here is import an existing service and start managing it in Terraform

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions