Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: invalid character '<' looking for beginning of value #202

Closed
jbartus opened this issue Oct 27, 2023 · 4 comments
Closed

Error: invalid character '<' looking for beginning of value #202

jbartus opened this issue Oct 27, 2023 · 4 comments

Comments

@jbartus
Copy link

jbartus commented Oct 27, 2023

sometimes when running this tf code

resource "sigsci_site" "demo_site" {
  display_name = "demosite"
  short_name   = "demosite"
  agent_level  = "block"
}

resource "sigsci_edge_deployment" "ngwaf_edge_demo" {
  site_short_name = sigsci_site.demo_site.short_name
}

I get the following error:

│ Error: invalid character '<' looking for beginning of value
│ 
│   with sigsci_edge_deployment.ngwaf_edge_demo,
│   on ngwaf.tf line 12, in resource "sigsci_edge_deployment" "ngwaf_edge_demo":
│   12: resource "sigsci_edge_deployment" "ngwaf_edge_demo" {
│ 
╵

here's my terraform and provider versions

jbartus@XFHFH62963 fsly-demo % tf version
Terraform v1.6.2
on darwin_arm64
+ provider registry.terraform.io/fastly/fastly v5.6.0
+ provider registry.terraform.io/hashicorp/google v5.3.0
+ provider registry.terraform.io/signalsciences/sigsci v2.1.3

if I simply wait a minute or two the problem goes away, I can re-run terraform apply and it will complete the setup.

the problem reproduces even with -parallelism=1

@rickardkarlsson
Copy link

I also experience the same problem.
It's quite frustrating to create new sites. When it mostly don't work.
Is there any solution to fix this?

@DanInProgress
Copy link

Also just got bit by this and a script was in use that ensures that TF_CLI_ARGS_apply=" -parallelism=1" is always set.

For others running into this issue:

if terraform plan is now showing:

-/+ destroy and then create replacement

Terraform will perform the following actions:

  # module.public_website.sigsci_edge_deployment.ngwaf_edge_site_service is tainted, so must be replaced
-/+ resource "sigsci_edge_deployment" "ngwaf_edge_site_service" {
      ~ id              = "<site-short-name>" -> (known after apply)
        # (1 unchanged attribute hidden)
    }

double check the signal sciences dashboard

if it already exists, skip this issue the second time around by using terraform import like this:

SITE_SHORT_NAME="<site-short-name>" # e.g. `public-website`
TF_RESOURCE_ADDR="<address>" # e.g. `module.public_website.sigsci_edge_deployment.ngwaf_edge_site_service`
terraform state rm -backup <please-make-a-backup.tfstate> "$TF_RESOURCE_ADDR"
terraform import "$TF_RESOURCE_ADDR" "$SITE_SHORT_NAME"

looks like terraform import isn't documented for sigsci_edge_deployment, so I opened #203 to review all docs for similar issues

@jbartus
Copy link
Author

jbartus commented Dec 1, 2023

done like 15 - 20 builds the last two days and haven't seen the error again

@jbartus jbartus closed this as completed Dec 1, 2023
@lra
Copy link

lra commented Mar 23, 2024

We are getting this error randomly using Terraform v1.7.5 on darwin_arm64 and signalsciences/sigsci v2.1.7.
Mayb the API is randomly failing? It could be returning something that's not a json when erroring out, leading to this message. e.g. https://austindewey.com/2020/12/11/troubleshooting-invalid-character-looking-for-beginning-of-value/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants