Skip to content

router: initial implementation - #148

Draft
mweibel wants to merge 5 commits into
masterfrom
mweibel/router
Draft

router: initial implementation#148
mweibel wants to merge 5 commits into
masterfrom
mweibel/router

Conversation

@mweibel

@mweibel mweibel commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@mweibel
mweibel force-pushed the mweibel/router branch 3 times, most recently from a6ba7c4 to 51e9444 Compare July 27, 2026 08:06
Base automatically changed from alain/lb-operations-mux to master July 27, 2026 13:12
Comment thread cloudscale/resource_cloudscale_interface.go
Comment thread go.mod
google.golang.org/protobuf v1.36.11 // indirect
)

replace github.com/cloudscale-ch/cloudscale-go-sdk/v9 => ../cloudscale-go-sdk

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ remove before trying to merge

@mweibel
mweibel force-pushed the mweibel/router branch 2 times, most recently from cfe208b to 80e7c38 Compare August 5, 2026 14:46
Comment thread docs/resources/router.md Outdated
In addition to the arguments listed above, the following computed attributes are exported:

* `href` - The cloudscale.ch API URL of the current router.
* `tags` - The tags assigned to this router.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

items already listed in ## Argument Reference should not be repeated here. applies to: tags and internet_gateway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


* `id` - (Optional) The UUID of a router.
* `name` - (Optional) The name of a router.
* `zone_slug` - (Optional) The zone slug of a router. Options include `lpg1` and `rma1`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be listed here, not in attributes:

* `tags` - (Optional) Filter by tags; the resource must have at least the specified key-value pairs (subset match).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch, done.

Comment thread docs/data-sources/router.md Outdated
In addition to the arguments listed above, the following computed attributes are exported:

* `href` - The cloudscale.ch API URL of the current router.
* `tags` - The tags assigned to this router.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, this goes I way I guess :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed ;) done.

Comment thread README.md

*Remember to replace `[your-username]` with your actual username.*

### Debugging with Delve

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity: why did you need this? for me it worked pretty good to debug the provider using the integration tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember exactly which part I needed to debug, but in general, I personally often prefer to debug using a debugger to be able to inspect what variables etc. hold in specific breakpoints.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes; me to. What i meant: the intellij debugger can attach to the tests without additional tooling.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah.. yeah that's true. Not sure why I didn't do it that way to be honest..

resource.TestCheckResourceAttr(
resourceName, "addresses.#", "1"),
resource.TestCheckResourceAttrSet(
resourceName, "addresses.0.address"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please try to assert all attributes, imho network_name, network_href and type are not asserted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread cloudscale/resource_cloudscale_router.go
Comment thread cloudscale/resource_cloudscale_interface.go

func gatherRouterUpdateRequest(d *schema.ResourceData) []*cloudscale.RouterUpdateRequest {
requests := make([]*cloudscale.RouterUpdateRequest, 0)
// FIXME: not implemented yet

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean the FIXME comment or the whole gatherRouterUpdateRequest function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it, along with all commented-out code.

Comment on lines +96 to +97
Optional: true,
Computed: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upstream API always requires an address on an interface. There is no auto-assign (contrary to server interfaces).

I think this should read:

			Required: true,

Also adjust the docs to reflect this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also maybe its worth the double check this is correct in the go-sdk

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks. SDK is not a problem.

- config.go: use context.Background() and NewSubsystemLoggingHTTPTransport
- gofmt/whitespace fixes in floating_ip datasource, volume test, provider test
Adds cloudscale_router (resource + data source) and cloudscale_interface,
plus a load-balancer health-monitor URLPath rename (due to lint).

Additionally:
- splitImportID: moved to util.go and parameterized so import errors name the
  correct attributes (router_uuid/interface_uuid vs pool_uuid/member_uuid)
- updates docs with attributes/arguments
- adds missing assertions
- corrects interface create computed/required/optional flags
- remove waitForDeleted: router/interface delete are now both
  synchronously deleted
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

Successfully merging this pull request may close these issues.

2 participants