Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nat network support #82

Closed
wants to merge 3 commits into from
Closed

Nat network support #82

wants to merge 3 commits into from

Conversation

isage
Copy link

@isage isage commented Oct 24, 2019

Add support for virtualbox nat networks as a resource and natnetwork type for NICs
E.g.:

resource "virtualbox_natnetwork" "vmnet10" {
    name = "vmnet10"
    dhcp = true
    network = "192.168.6.0/24"
}

resource "virtualbox_vm" "squid" {
  count     = 2
  name      = format("node%02d", count.index + 1)
  image     = "virtualbox.box"
  cpus      = 1
  memory    = "256 mib"

  network_adapter {
    type           = "hostonly"
    host_interface = "vboxnet0"
  }

  network_adapter {
    type           = "natnetwork"
    nat_network    = virtualbox_natnetwork.vmnet10.name
  }
}

Requires terra-farm/go-virtualbox#13

@VoyTechnology
Copy link
Member

Please take a look at the failing CI @isage.

@isage
Copy link
Author

isage commented Oct 30, 2019

It states right there in description that it requires terra-farm/go-virtualbox#13 of course it will fail otherwise.

@VoyTechnology
Copy link
Member

Sorry, I missed that.

@nevill
Copy link
Contributor

nevill commented Nov 3, 2019

I just compiled the code (of course with terra-farm/go-virtualbox#13) and everything works well.

The thing is, in NAT Network, we cannot connect to the VM directly. But, usually terraform provisioners require a network connection to control it. Is there any work-around? Like providing a port forward resource and using it as connection?

@isage
Copy link
Author

isage commented Nov 3, 2019 via email

@patsevanton
Copy link
Contributor

I think need use NAT Network with Host-only Network.

@nevill
Copy link
Contributor

nevill commented Nov 4, 2019

I think need use NAT Network with Host-only Network.

@patsevanton In this case, Host-only + NAT is working and preferred. Because it doesn't need to create a NAT Network.

@patsevanton
Copy link
Contributor

patsevanton commented Nov 4, 2019

@nevill NAT interface have equal IP address on all virtualbox machine

#75

Host-only + NAT Network have different IP address on all virtualbox machine

@nevill
Copy link
Contributor

nevill commented Nov 4, 2019

@nevill NAT interface have equal IP address on all virtualbox machine

#75

Host-only + NAT Network have different IP address on all virtualbox machine

Yes, I understand the difference. Host-only NIC can have different IPs. In this way, they're equivalent, but NAT Network has one more resource to create.

I'd like to use NAT Network if the connection problem mentioned above gets resolved.

@patsevanton
Copy link
Contributor

Hello! may be merge PR?

@jpts
Copy link
Contributor

jpts commented May 9, 2021

Hi folks, I'm interested in getting this functionality merged in (in addition to the go library PR). Is there anything else that needs to be done for this, except for rebasing and resolving conflicts?

@isage are you still interested in picking this up, or should I create a new PR to pickup the work in?

@isage
Copy link
Author

isage commented May 10, 2021 via email

@VoyTechnology
Copy link
Member

Closing in favour of #103.

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.

5 participants