## TL;DR

Two arguments ended up on one line, or you used non-HCL syntax (like a JavaScript function call) inside a `.tf` file. HCL wants one argument per line. Split them, replace JS-isms with HCL natives (`jsonencode`), and run `terraform fmt`.

## The error

```text
Error: Missing newline after argument

  on main.tf line 200:
  200: event_pattern = JSON.stringify({
```

## Steps to fix

1. Open the flagged line. Look for two arguments jammed together, or a function call from another language (`JSON.stringify`, etc.).
   - Expected: you spot the offending syntax.
2. Rewrite in HCL: one argument per line, HCL-native functions:
   ```hcl
   event_pattern = jsonencode({
     source = ["my.service"]
   })
   ```
   - Expected: no foreign syntax remains.
3. Run `terraform fmt` then `terraform validate`.
   - Expected: `Success! The configuration is valid.`

## When to use this

- `terraform validate`/`plan` fails with `Missing newline after argument` after editing or pasting config, especially config translated from another language.

## When NOT to use this

- `Invalid character` (e.g. `;`) is the sibling error for characters HCL rejects outright. If the line looks fine, check for invisible characters from copy-paste.

## Compatibility

- All Terraform versions; HCL2 syntax rules are stable.

## Root cause

HCL separates block arguments with newlines. Pasting multi-argument snippets onto one line, or transliterating JavaScript/Python expressions directly into `.tf` files, produces tokens the parser cannot split into separate arguments.

## Edge cases

- Heredocs (`<<EOT`) containing code from other languages are fine; the error only applies to HCL outside strings.
- `terraform fmt` will not fix this; it only formats valid syntax. Fix the syntax first, then format.