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

Configuration of multiple NICs #118

Closed
WildWon opened this issue Nov 21, 2018 · 7 comments · Fixed by #233
Closed

Configuration of multiple NICs #118

WildWon opened this issue Nov 21, 2018 · 7 comments · Fixed by #233
Assignees

Comments

@WildWon
Copy link

WildWon commented Nov 21, 2018

Hi there,

When deploying a vm from template currently only one NIC can be configured. Vms with multiple NICs have to be manually reconfigured after deployment.

Terraform Version

Terraform v0.11.10

  • provider.vcd (unversioned) built from (git commit 704012e) of the "vmware-takes-ownership" branch

Affected Resource(s)

resource "vcd_vapp_vm"

Terraform Configuration Files

resource "vcd_vapp_vm" "my_vm01" {
	vapp_name = "${var.vappname}"
	name = "${var.vmnamewin}"
	catalog_name = "${var.catalognamewin}"
	template_name = "${var.templatenamewin}"
	memory = 4096
	cpus = 2
	ip = ""
	power_on = false
	network_name = "${var.networkname}"
}

Debug Output

n/a

Panic Output

n/a

Expected Behavior

Being able to either configure all NICs of a template or alternatively add NICs incl. configuration to a vm at deployment.

Actual Behavior

Only one NIC can be configured

Steps to Reproduce

This can be easily reproduced by deploying a new vm to a vCloud instance

Important Factoids

n/a

References

n/a

@lvirbalas
Copy link
Collaborator

Thanks @WildWon for this issue!

@vbauzysvmware please have a crack at it. One caveat is that we need to maintain backwards compatibility with existing behaviour.

@dn1s
Copy link
Contributor

dn1s commented Jan 25, 2019

I'm working on this feature. Will probably issue a pull request in a couple of days.

@lvirbalas
Copy link
Collaborator

@dn1s, that's great. Please take assignment of this task if you can (for some reason GitHub doesn't allow me to select you from the list).

@dn1s
Copy link
Contributor

dn1s commented Feb 26, 2019

I have a question about this feature.
Can I deprecate network_name and ip parameter like this: https://www.terraform.io/docs/extend/best-practices/deprecations.html#provider-attribute-removal

In favor of a new parameter networks with a structure like this:

"networks": {
	Type:          schema.TypeList,
	Optional:      true,
	ForceNew:      true,
	ConflictsWith: []string{"ip"},
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"orgnetwork": {
				Required: true,
				Type:     schema.TypeString,
			},
			"ip": {
				Computed:         true,
				DiffSuppressFunc: suppressIfIpIsOneOf(),
				Optional:         true,
				Type:             schema.TypeString,
			},
			"ip_address_allocation_mode": {
				Default:      "POOL",
				Optional:     true,
				Type:         schema.TypeString,
				ValidateFunc: checkIpAddressAllocationMode(),
			},
			"is_primary": {
				Type:     schema.TypeBool,
				Default:  false,
				Optional: true,
			},
			"adapter_type": {
				Type:     schema.TypeString,
				ForceNew: true,
				Optional: true,
			},
			"mac": {
				Computed: true,
				Optional: true,
				Type:     schema.TypeString,
			},
		},
	},
},

@dn1s
Copy link
Contributor

dn1s commented Feb 27, 2019

I'd be ready to open up a new pr. I have another question though.
When I have a network interface and I want to change the ip_address_allocation_mode afterwards from let's say "POOL" to "DHCP", vmware does not ensure that /etc/sysconfig/network-scripts/ifcfg-eth0 is written properly again. For example it stays like it is. And if I completely remove the file and reboot vm it will create it again only containing "HWADDR" .
So do I have to ensure with the provider this is fixed or should the user fix it?
I probably can fix this in the provider but it would mean to completely remove the nics and attach them again. This might break stuff!
@lvirbalas what's your opinion on this?

@pasikarkkainen
Copy link
Contributor

@dn1s Sounds like the VM needs to do guest customization again (forced re-customization). Normally guest customization is only done on first boot. And that's the component which updates root/admin password, hostname, IP settings, etc.

@dn1s
Copy link
Contributor

dn1s commented Feb 28, 2019

@pasikarkkainen After talking a lot about this problem with a college of mine. We came to the conclusion to just force a new vm if network changes since this is out of scope from terraform to handle guestCustomization after initalization. It's probably possible to workaround this problem with providing your own script which is capable of updating network config files in initscript but I would not recommend that.

dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Feb 28, 2019
- implements multi nic support for vm.
- deprecated network_name/network_href/ip params in favor
of new networks parameter
- fixes vmware#50 and vmware#118
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Feb 28, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Mar 5, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Mar 6, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
@lvirbalas lvirbalas assigned dataclouder, Didainius and vbauzys and unassigned vbauzys Mar 7, 2019
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Mar 11, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Mar 12, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Apr 1, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Apr 1, 2019
  - new attribute networks
  - new attribute mac

Resolves issue (vmware#118)
dn1s added a commit to dn1s/terraform-provider-vcd that referenced this issue Apr 2, 2019
- implements multi nic support for vm.
- deprecates network_name/network_href/ip attributes in favor
of new networks attribute
- fixes vmware#50 and vmware#118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants