Files
Oscar Hermoso 77271b0efd ✂️ Add separate_private_network_interface to server resource & data source (#125) (#126)
* Initial plan

* Initial plan for separate_private_network_interface support

Agent-Logs-Url: https://github.com/oscarhermoso/terraform-provider-binarylane/sessions/df438ec9-fdbb-47a3-8ebb-592ee2843eed

* Add separate_private_network_interface to server resource and data source

Agent-Logs-Url: https://github.com/oscarhermoso/terraform-provider-binarylane/sessions/df438ec9-fdbb-47a3-8ebb-592ee2843eed

* Run go fmt and add AGENTS.md

Agent-Logs-Url: https://github.com/oscarhermoso/terraform-provider-binarylane/sessions/1f274b93-d7c2-4547-a24d-8d36472c8092

* Add source_and_destination_check assertion to data source test checks

Agent-Logs-Url: https://github.com/oscarhermoso/terraform-provider-binarylane/sessions/8684d505-33e7-407c-a4fb-c6260ffdb2ea

* go generate: update types_gen.go with latest API schema (Action.Reason, Action.Title, Invoice.InvoiceViewUrl)

Agent-Logs-Url: https://github.com/oscarhermoso/terraform-provider-binarylane/sessions/1baa947c-aaee-4c45-b2b8-9495ccf38b82

* Fix separate_private_network_interface: add ModifyPlan unknown handling and IsUnknown guard in Update

Agent-Logs-Url: https://github.com/oscarhermoso/terraform-provider-binarylane/sessions/e9b9d51d-8447-48a5-8c61-9c749562c3e1

* Simplify separate_private_network_interface description and remove dead code

Match the OpenAPI schema phrasing for consistency with other attribute
descriptions, and drop the defensive IsUnknown guard in Update — ModifyPlan
already resolves Unknown to Null/false before Update runs.

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2026-04-09 10:52:53 +08:00

1.6 KiB

AGENTS.md

Before starting

Run go generate to pull in the latest API schema before making changes.

Code style

  • Follow patterns in existing resources, especially server_resource.go and server_data_source.go.
  • New server attributes that map to a post-creation API action (e.g. change_*) follow the source_and_destination_check / separate_private_network_interface pattern: read the planned value before the first state save, call the action after creation if the value differs from the server default, and handle updates in the Update method.
  • Run go fmt ./... before finishing — the CI will fail without it.
  • Don't add Required: false when Optional: true is already set; it is redundant.

Testing

  • Tests live in internal/provider/*_test.go.
  • A valid BINARYLANE_API_TOKEN is required; tests create real servers that cost money — be conscientious.
  • Always run the sweeper after tests, regardless of success or failure:
    go test -v ./internal/provider/... -sweep=all
    
  • Run a specific test with:
    go test -v -run TestServerResource ./internal/provider/...
    
  • New attributes on the server resource should be exercised inside an existing test step where possible (e.g. the first step of TestServerResource already provisions a VPC server).

Workflow

  1. go generate — fetch latest OpenAPI spec and regenerate code + docs.
  2. Make changes.
  3. go fmt ./... — format code.
  4. go build ./... — verify it compiles.
  5. go vet ./... — catch common mistakes.
  6. Run relevant tests, then sweep.
  7. go generate again to regenerate docs if schema or descriptions changed.