foltik/terraform-provider-vyos

Changes not saved on commit

Closed this issue · 6 comments

As there is no commit after the save the changes are lost on reboot.

I would like to avoid having to ssh into the routers to persist the changes. This could be accomplish either by default or based on a new provider configuration such as:

provider "vyos" {
  url = "https://vyos.local"
  key = "xxxxxxxxx"
  save_on_commit = True
}

If we go with making it configurable - any reason for not making the default to be saving?

This change will also require an extension of the vyos_client. I can do PRs for both changes if @foltik agrees on the proposal.

I think we should save to /config/config.boot by default, but make it configurable. One use case I can think of is having the config file saved to an alternative location on a TFTP server for PXE booted VyOS instances. The provider configuration for this could look like:

provider "vyos" {
  # ...
  save = True
  save_location = "tftp://10.0.0.1/config.boot"
}

I'm going to make some changes to the go client tomorrow, I'll add the Save (and Load) methods needed for this while I'm at it.

To be more consistent with the VyOS API parameters, I think we should actually name the fields:

provider "vyos" {
  # ...
  save = True
  save_file = "..."
}

This should now be doable with foltik/vyos-client-go#2

Thanks @foltik - are you looking for me to do the PR? I could do so in a few days.

If you're willing, that would be great!

@foltik - added support to save configs -> #12. Please notice the dependency on foltik/vyos-client-go#3 where I added support for context (timeouts, cancels)