Issue Running OpsGenie Provider with Terraform 0.12.7

Hi All,

Currently I am getting some errors while trying to run Terraform apply, I am using the OpsGenie provider: currently unable to find any information about this type of error, no other provider that i am currently using is giving this type of error:

Error: Response could not be parsed, invalid character ‘<’ looking for beginning of value

Versions:

Terraform v0.12.7

  • provider.opsgenie v0.2.3

Error: Response could not be parsed, invalid character ‘<’ looking for beginning of value

# Configure the Opsgenie Provider
provider "opsgenie" {
  api_key = "${var.api_key}"
  api_url = "${var.api_url}"
}

# Create Single User
resource "opsgenie_user" "first_user" {
  username  = " "
  full_name = " "
  role = "${var.administrator}"
}

# Add User to Team
resource "opsgenie_team" "GTI" {
  name        = "GTI"
  description = "GTI Opsgenie"

  member {
    id   = "${opsgenie_user.test.id}"
    role = "${var.administrator}"
  }
  member{
    id = " "
    role = "${var.user}"
  }
}

#Create Schedule
resource "opsgenie_schedule" "GTISchedule" {
  name = "GTI Schedule"
  description = "GTI-Primary"
  timezone = "Europe/Dublin"
  enabled = true
  owner_team_id = "${opsgenie_team.GTI.id}"
}


#Create Schedule Rotation
resource "opsgenie_schedule_rotation" "test" { 
    schedule_id = "${opsgenie_schedule.GTISchedule.id}"
    name = "test"
    start_date = "2019-09-26T10:30:00Z"
    end_date = "2019-11-01T17:30:00Z"
    type = "weekly"
    length = 1
    participant {
      type = "user"
      id = "${opsgenie_user.first_user.id}"
    }
    time_restriction {
      type ="time-of-day"
      restriction {
        start_hour = 1
        start_min = 1
        end_hour = 10
        end_min = 1
      }
}
}

Hi @dfoley84,

I’m not very knowledgeable about OpsGenie in particular, but from that error message it seems like OpsGenie provider made an API request and got a response containing HTML rather than whatever format it was actually expecting.

Since it’s caused by an upstream problem in the API, I’m not sure what to suggest. If you run Terraform with the environment variable TF_LOG=debug then you might see some debug output from the provider that could give a hint as to what the provider was trying to do when it got this error and what the server actually returned, though each provider is responsible for its own debug output so I can’t say for certain that this provider will produce something useful for this case. If you look in the output for messages containing the string terraform-provider-opsgenie that will hopefully help narrow it down.

Thanks while i don’t see any errors while running grep on terraform-provider-opsgenie

2019-09-27T08:37:36.952Z [DEBUG] plugin: plugin started: path=/home/ubuntu/NewUser/.terraform/plugins/linux_amd64/terraform-provider-opsgenie_v0.2.3_x4 pid=2749
2019-09-27T08:37:36.952Z [DEBUG] plugin: waiting for RPC address: path=/home/ubuntu/NewUser/.terraform/plugins/linux_amd64/terraform-provider-opsgenie_v0.2.3_x4
2019-09-27T08:37:36.964Z [INFO]  plugin.terraform-provider-opsgenie_v0.2.3_x4: configuring server automatic mTLS: timestamp=2019-09-27T08:37:36.964Z
2019-09-27T08:37:37.005Z [DEBUG] plugin.terraform-provider-opsgenie_v0.2.3_x4: plugin address: address=/tmp/plugin478246039 network=unix timestamp=2019-09-27T08:37:37.004Z
2019-09-27T08:37:37.092Z [DEBUG] plugin.terraform-provider-opsgenie_v0.2.3_x4: 2019/09/27 08:37:37 [INFO] Initializing OpsGenie client
2019-09-27T08:37:37.092Z [DEBUG] plugin.terraform-provider-opsgenie_v0.2.3_x4: 2019/09/27 08:37:37 [INFO] OpsGenie client configured
2019-09-27T08:37:37.101Z [DEBUG] plugin.terraform-provider-opsgenie_v0.2.3_x4: 2019/09/27 08:37:37 [INFO] Creating OpsGenie user 'david.foley@mycit.ie'
2019-09-27T08:37:37.124Z [DEBUG] plugin: plugin process exited: path=/home/ubuntu/NewUser/.terraform/plugins/linux_amd64/terraform-provider-opsgenie_v0.2.3_x4 pid=2749
root@instance-1:/home/ubuntu/NewUser# ls

I did do a grep on first and did output a few

    opsgenie_user.first_user - *terraform.NodeValidatableResource
2019/09/27 08:37:32 [TRACE] AttachResourceConfigTransformer: attaching to "opsgenie_user.first_user" (*terraform.NodeValidatableResource) config from main.tf:8,1-38
opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
2019/09/27 08:37:32 [TRACE] ProviderTransformer: opsgenie_user.first_user is provided by provider.opsgenie or inherited equivalent
2019/09/27 08:37:32 [TRACE] ProviderTransformer: exact match for provider.opsgenie serving opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ProviderTransformer: "opsgenie_user.first_user" (*terraform.NodeValidatableResource) needs provider.opsgenie
opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
2019/09/27 08:37:32 [TRACE] AttachSchemaTransformer: attaching resource schema to opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_team.GTI" references: [opsgenie_user.first_user var.administrator var.user]
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_schedule_rotation.test" references: [opsgenie_schedule.GTISchedule opsgenie_user.first_user]
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user" references: [var.administrator]
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
  opsgenie_user.first_user - *terraform.NodeValidatableResource
opsgenie_user.first_user - *terraform.NodeValidatableResource
2019/09/27 08:37:32 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "provider.opsgenie"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "var.administrator"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_team.GTI" waiting on "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: dependencies changed for "opsgenie_user.first_user", sending new deps
2019/09/27 08:37:32 [TRACE] dag/walk: visiting "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": starting visit (*terraform.NodeValidatableResource)
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": evaluating
2019/09/27 08:37:32 [TRACE] [walkValidate] Entering eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] [walkValidate] Exiting eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": visit complete
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
2019/09/27 08:37:32 [TRACE] AttachResourceConfigTransformer: attaching to "opsgenie_user.first_user" (*terraform.NodeRefreshableManagedResource) config from main.tf:8,1-38
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
2019/09/27 08:37:32 [TRACE] ProviderTransformer: opsgenie_user.first_user is provided by provider.opsgenie or inherited equivalent
2019/09/27 08:37:32 [TRACE] ProviderTransformer: exact match for provider.opsgenie serving opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ProviderTransformer: "opsgenie_user.first_user" (*terraform.NodeRefreshableManagedResource) needs provider.opsgenie
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
2019/09/27 08:37:32 [TRACE] AttachSchemaTransformer: attaching resource schema to opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user" references: [var.administrator]
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_team.GTI" references: [opsgenie_user.first_user var.administrator var.user]
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_schedule_rotation.test" references: [opsgenie_schedule.GTISchedule opsgenie_user.first_user]
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
  opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResource
2019/09/27 08:37:32 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "var.administrator"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "provider.opsgenie"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_team.GTI" waiting on "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: dependencies changed for "opsgenie_user.first_user", sending new deps
2019/09/27 08:37:32 [TRACE] dag/walk: visiting "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": starting visit (*terraform.NodeRefreshableManagedResource)
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": expanding dynamic subgraph
opsgenie_user.first_user - *terraform.NodeRefreshableManagedResourceInstance
2019/09/27 08:37:32 [DEBUG] Resource state not found for node "opsgenie_user.first_user", instance opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user" references: []
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": entering dynamic subgraph
2019/09/27 08:37:32 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: visiting "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": starting visit (*terraform.NodeRefreshableManagedResourceInstance)
2019/09/27 08:37:32 [TRACE] NodeRefreshableManagedResourceInstance: opsgenie_user.first_user has no existing state to refresh
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": evaluating
2019/09/27 08:37:32 [TRACE] [walkRefresh] Entering eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] EvalReadState: reading state for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] EvalReadState: no state present for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] Re-validating config for "opsgenie_user.first_user"
2019/09/27 08:37:32 [WARN] Provider "opsgenie" produced an invalid plan for opsgenie_user.first_user, but we are tolerating it because it is using the legacy plugin SDK.
2019/09/27 08:37:32 [TRACE] EvalWriteState: writing current state object for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] EvalWriteDiff: recorded Create change for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] [walkRefresh] Exiting eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": visit complete
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": dynamic subgraph completed successfully
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": visit complete
2019/09/27 08:37:32 [TRACE] GetResourceInstance: opsgenie_user.first_user is a single instance
2019/09/27 08:37:32 [TRACE] GetResourceInstance: opsgenie_user.first_user is a single instance
opsgenie_user.first_user - *terraform.NodePlannableResource
2019/09/27 08:37:32 [TRACE] AttachResourceConfigTransformer: attaching to "opsgenie_user.first_user" (*terraform.NodePlannableResource) config from main.tf:8,1-38
opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
2019/09/27 08:37:32 [TRACE] ProviderTransformer: opsgenie_user.first_user is provided by provider.opsgenie or inherited equivalent
2019/09/27 08:37:32 [TRACE] ProviderTransformer: exact match for provider.opsgenie serving opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ProviderTransformer: "opsgenie_user.first_user" (*terraform.NodePlannableResource) needs provider.opsgenie
opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
2019/09/27 08:37:32 [TRACE] AttachSchemaTransformer: attaching resource schema to opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_schedule_rotation.test" references: [opsgenie_schedule.GTISchedule opsgenie_user.first_user]
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user" references: [var.administrator]
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_team.GTI" references: [opsgenie_user.first_user var.administrator var.user]
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
2019/09/27 08:37:32 [TRACE] ForcedCBDTransformer: "opsgenie_user.first_user" (*terraform.NodePlannableResource) has no CBD descendent, so skipping
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
  opsgenie_user.first_user - *terraform.NodePlannableResource
opsgenie_user.first_user - *terraform.NodePlannableResource
2019/09/27 08:37:32 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_team.GTI" waiting on "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "var.administrator"
2019/09/27 08:37:32 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "provider.opsgenie"
2019/09/27 08:37:32 [TRACE] dag/walk: dependencies changed for "opsgenie_user.first_user", sending new deps
2019/09/27 08:37:32 [TRACE] dag/walk: visiting "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": starting visit (*terraform.NodePlannableResource)
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": evaluating
2019/09/27 08:37:32 [TRACE] [walkPlan] Entering eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] [walkPlan] Exiting eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": expanding dynamic subgraph
opsgenie_user.first_user - *terraform.NodePlannableResourceInstance
2019/09/27 08:37:32 [DEBUG] Resource instance state not found for node "opsgenie_user.first_user", instance opsgenie_user.first_user
2019/09/27 08:37:32 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user" references: []
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": entering dynamic subgraph
2019/09/27 08:37:32 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] dag/walk: visiting "opsgenie_user.first_user"
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": starting visit (*terraform.NodePlannableResourceInstance)
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": evaluating
2019/09/27 08:37:32 [TRACE] [walkPlan] Entering eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] EvalReadState: reading state for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] EvalReadState: no state present for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] Re-validating config for "opsgenie_user.first_user"
2019/09/27 08:37:32 [WARN] Provider "opsgenie" produced an invalid plan for opsgenie_user.first_user, but we are tolerating it because it is using the legacy plugin SDK.
2019/09/27 08:37:32 [TRACE] EvalWriteState: writing current state object for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] EvalWriteDiff: recorded Create change for opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] [walkPlan] Exiting eval tree: opsgenie_user.first_user
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": visit complete
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": dynamic subgraph completed successfully
2019/09/27 08:37:32 [TRACE] vertex "opsgenie_user.first_user": visit complete
2019/09/27 08:37:32 [TRACE] GetResourceInstance: opsgenie_user.first_user is a single instance
2019/09/27 08:37:32 [TRACE] GetResourceInstance: opsgenie_user.first_user is a single instance
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
2019/09/27 08:37:36 [TRACE] DiffTransformer: found Create change for opsgenie_user.first_user 
2019/09/27 08:37:36 [TRACE] DiffTransformer: opsgenie_user.first_user will be represented by opsgenie_user.first_user
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
2019/09/27 08:37:36 [TRACE] AttachResourceConfigTransformer: attaching to "opsgenie_user.first_user" (*terraform.NodeApplyableResourceInstance) config from main.tf:8,1-38
2019/09/27 08:37:36 [TRACE] AttachResourceConfigTransformer: attaching to "opsgenie_user.first_user (prepare state)" (*terraform.NodeApplyableResource) config from main.tf:8,1-38
2019/09/27 08:37:36 [DEBUG] Resource state not found for node "opsgenie_user.first_user", instance opsgenie_user.first_user
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
2019/09/27 08:37:36 [TRACE] ProviderTransformer: opsgenie_user.first_user is provided by provider.opsgenie or inherited equivalent
2019/09/27 08:37:36 [TRACE] ProviderTransformer: opsgenie_user.first_user (prepare state) is provided by provider.opsgenie or inherited equivalent
2019/09/27 08:37:36 [TRACE] ProviderTransformer: exact match for provider.opsgenie serving opsgenie_user.first_user
2019/09/27 08:37:36 [DEBUG] ProviderTransformer: "opsgenie_user.first_user" (*terraform.NodeApplyableResourceInstance) needs provider.opsgenie
2019/09/27 08:37:36 [TRACE] ProviderTransformer: exact match for provider.opsgenie serving opsgenie_user.first_user (prepare state)
2019/09/27 08:37:36 [DEBUG] ProviderTransformer: "opsgenie_user.first_user (prepare state)" (*terraform.NodeApplyableResource) needs provider.opsgenie
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
2019/09/27 08:37:36 [TRACE] AttachSchemaTransformer: attaching resource schema to opsgenie_user.first_user
2019/09/27 08:37:36 [TRACE] AttachSchemaTransformer: attaching resource schema to opsgenie_user.first_user (prepare state)
2019/09/27 08:37:36 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user (prepare state)" references: []
2019/09/27 08:37:36 [DEBUG] ReferenceTransformer: "opsgenie_user.first_user" references: [var.administrator]
2019/09/27 08:37:36 [DEBUG] ReferenceTransformer: "opsgenie_team.GTI" references: [var.administrator opsgenie_user.first_user (prepare state) opsgenie_user.first_user opsgenie_user.first_user var.user]
2019/09/27 08:37:36 [DEBUG] ReferenceTransformer: "opsgenie_schedule_rotation.test" references: [opsgenie_schedule.GTISchedule (prepare state) opsgenie_schedule.GTISchedule opsgenie_schedule.GTISchedule opsgenie_user.first_user (prepare state) opsgenie_user.first_user opsgenie_user.first_user]
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
  opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
opsgenie_user.first_user - *terraform.NodeApplyableResourceInstance
  opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
opsgenie_user.first_user (prepare state) - *terraform.NodeApplyableResource
2019/09/27 08:37:36 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user (prepare state)"
2019/09/27 08:37:36 [TRACE] dag/walk: added new vertex: "opsgenie_user.first_user"
2019/09/27 08:37:36 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "opsgenie_user.first_user (prepare state)"
2019/09/27 08:37:36 [TRACE] dag/walk: added edge: "opsgenie_user.first_user" waiting on "var.administrator"
2019/09/27 08:37:36 [TRACE] dag/walk: added edge: "opsgenie_user.first_user (prepare state)" waiting on "provider.opsgenie"
2019/09/27 08:37:36 [TRACE] dag/walk: added edge: "opsgenie_team.GTI" waiting on "opsgenie_user.first_user"
2019/09/27 08:37:36 [TRACE] dag/walk: dependencies changed for "opsgenie_user.first_user", sending new deps
2019/09/27 08:37:36 [TRACE] dag/walk: dependencies changed for "opsgenie_user.first_user (prepare state)", sending new deps
2019/09/27 08:37:37 [TRACE] dag/walk: visiting "opsgenie_user.first_user (prepare state)"
2019/09/27 08:37:37 [TRACE] vertex "opsgenie_user.first_user (prepare state)": starting visit (*terraform.NodeApplyableResource)
2019/09/27 08:37:37 [TRACE] vertex "opsgenie_user.first_user (prepare state)": evaluating
2019/09/27 08:37:37 [TRACE] [walkApply] Entering eval tree: opsgenie_user.first_user (prepare state)
2019/09/27 08:37:37 [TRACE] [walkApply] Exiting eval tree: opsgenie_user.first_user (prepare state)
2019/09/27 08:37:37 [TRACE] vertex "opsgenie_user.first_user (prepare state)": visit complete
2019/09/27 08:37:37 [TRACE] dag/walk: visiting "opsgenie_user.first_user"
2019/09/27 08:37:37 [TRACE] vertex "opsgenie_user.first_user": starting visit (*terraform.NodeApplyableResourceInstance)
2019/09/27 08:37:37 [TRACE] vertex "opsgenie_user.first_user": evaluating
2019/09/27 08:37:37 [TRACE] [walkApply] Entering eval tree: opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] EvalReadDiff: Read Create change from plan for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] EvalReadState: reading state for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] EvalReadState: no state present for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] EvalReadDiff: Read Create change from plan for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] Re-validating config for "opsgenie_user.first_user"
2019/09/27 08:37:37 [WARN] Provider "opsgenie" produced an invalid plan for opsgenie_user.first_user, but we are tolerating it because it is using the legacy plugin SDK.
2019/09/27 08:37:37 [TRACE] EvalReadState: reading state for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] EvalReadState: no state present for opsgenie_user.first_user
2019/09/27 08:37:37 [DEBUG] opsgenie_user.first_user: applying the planned Create change
2019/09/27 08:37:37 [DEBUG] opsgenie_user.first_user: apply errored, but we're indicating that via the Error pointer rather than returning it: Response could not be parsed, invalid character '<' looking for beginning of value
2019/09/27 08:37:37 [TRACE] EvalMaybeTainted: opsgenie_user.first_user encountered an error during creation, so it is now marked as tainted
2019/09/27 08:37:37 [TRACE] EvalWriteState: removing state object for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] EvalApplyProvisioners: opsgenie_user.first_user has no state, so skipping provisioners
2019/09/27 08:37:37 [TRACE] EvalMaybeTainted: opsgenie_user.first_user encountered an error during creation, so it is now marked as tainted
2019/09/27 08:37:37 [TRACE] EvalWriteState: removing state object for opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] [walkApply] Exiting eval tree: opsgenie_user.first_user
2019/09/27 08:37:37 [TRACE] vertex "opsgenie_user.first_user": visit complete

It’s unfortunate that the provider doesn’t seem to be emitting any additional debug information, but at least this log does help by narrowing down what operation Terraform was working on when this failed:

It was trying to create opsgenie_user.first_user, which at least narrows the problem down to that particular operation:

Interestingly I do see some logging statements in the underlying API client for OpsGenie, so I guess the logging just isn’t showing through in Terraform’s logs for some reason. :confounded:

I was at least able to confirm that this message is indeed arising from the provider’s parsing of the API response, here:

I think the best next step here would be to open a bug report issue in the OpsGenie provider repository so that the maintainers of the provider can dig in to what’s going on here. Hopefully it’s at least possible to improve this error message to give a little more context as to what’s going on.