foltik / terraform-provider-vyos

VyOS Router Provider for Terraform (WIP)
MIT License
18 stars 7 forks source link

Changes not saved on commit #9

Closed angelnu closed 2 years ago

angelnu commented 2 years ago

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.

foltik commented 2 years ago

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.

foltik commented 2 years ago

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

provider "vyos" {
  # ...
  save = True
  save_file = "..."
}
foltik commented 2 years ago

This should now be doable with https://github.com/Foltik/vyos-client-go/pull/2

angelnu commented 2 years ago

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

foltik commented 2 years ago

If you're willing, that would be great!

angelnu commented 2 years ago

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