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

OpenStack Subnet DHCP disabled by default (Change in previous behavior) #6748

Closed
serialh0bbyist opened this issue May 18, 2016 · 13 comments · Fixed by #6838
Closed

OpenStack Subnet DHCP disabled by default (Change in previous behavior) #6748

serialh0bbyist opened this issue May 18, 2016 · 13 comments · Fixed by #6838

Comments

@serialh0bbyist
Copy link

Hello,

Running terraform v 0.6.16

Unfortunately, I cannot give all of my configurations due to the sensitivity of this environment, but when using the following code

###############################################################################
# Create Network
###############################################################################
resource "openstack_networking_network_v2" "network_1" {
  name = "network"
  admin_state_up = "true"
}
###############################################################################
# Create Subnet
###############################################################################
resource "openstack_networking_subnet_v2" "subnet_1" {
  name = "subnet"
  network_id = "${openstack_networking_network_v2.network_1.id}"
  cidr = "${var.cidr}"
  ip_version = 4
  dns_nameservers = ["${var.dns.one}", "${var.dns.two}"]
}
###############################################################################
# Create Router
###############################################################################
resource "openstack_networking_router_v2" "router_1" {
  name = "router"
  external_gateway = "${var.external_gateway}"
}
resource "openstack_networking_router_interface_v2" "router_interface_1" {
  router_id = "${openstack_networking_router_v2.router_1.id}"
  subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
}
###############################################################################

It looks like in version 0.6.15 this commit was introduced, changing the default behavior of the code above. Before DHCP was automatically enabled but with 0.6.15 and up the default behavior is to disable DHCP.

This can be duplicated by downgrading the terraform version to below 0.6.15.

I suspect that this is the culprit

d15a0eb

@jtopjian
Copy link
Contributor

@as0bu That's correct. d15a0eb fixed a bug that was not passing the enable_dhcp parameter correctly when it was set to false. Fixing the bug made no changes to the Terraform schema, so the natural behavior of this resource is to have DHCP disabled by default.

Adding the following to your subnet blocks will turn DHCP on:

enable_dhcp = true

@serialh0bbyist
Copy link
Author

@jtopjian So I'm guessing that this will be the default behavior from now on? If so could the documentation be updated to reflect this? Thanks!

@jtopjian
Copy link
Contributor

@as0bu Yes, this will be the default behavior. There were two reasons for making DHCP off by default:

  1. No changes to the schema
  2. It's more intuitive to opt-in to DHCP with
enable_dhcp = true

Than

enable_dhcp = false

enable_dhcp could have been renamed to disable_dhcp, but that would have made a schema change and affected a larger number of users...

And yes, looks like I forgot to make a note in the documentation. Will mark this issue as a bug to get that resolved. Good call. 😄

@serialh0bbyist
Copy link
Author

Thanks @jtopjian!

@sandywater
Copy link

I also just ran into this issue. Enable DHCP set to true should be the default behavior because when you manually create networks in OpenStack it is the default:
screen shot 2016-05-18 at 4 45 04 pm

@serialh0bbyist
Copy link
Author

@sandywater good point.

@jtopjian
Copy link
Contributor

Yes, understood, but keep in mind that before the aforementioned merge happened, it was impossible to turn DHCP off. The decision to have DHCP off by default was done to affect the smallest group possible at the point of release.

I will look at changing this behavior so that DHCP is enabled by default, perhaps for the next release since there will be some other major changes happening with the OpenStack provider.

@sandywater
Copy link

👍 thanks @jtopjian

@jtopjian
Copy link
Contributor

@sandywater np at all!

For some background on the wonkiness of this particular switch, see here 😄

@civik
Copy link

civik commented May 23, 2016

Just adding another point to this issue. Defaults should be set to drive a user down the most common use cases. This default will need to be overridden by a large majority of people using the Openstack provider. There is very little use case for disabling DHCP in Openstack, IMHO. Cloud init metadata breaks with DHCP disabled, making config_drive the only practical way for a user to configure the instance - which is atypical. I would advocate for enable_dhcp to be true as default or you're going to see a lot of confused users unless this is clearly documented.

@jtopjian
Copy link
Contributor

There is very little use case for disabling DHCP in Openstack, IMHO.

I think this is overlooking a lot of valid scenarios. A user who creates anything beyond a single network and single subnet for instances is going to run into DHCP issues. There are also subnets that tie into provider networks. However, I do agree that beginner or light users of Neutron are going to expect DHCP to "just work".

This has been fixed in #6838.

@civik
Copy link

civik commented May 24, 2016

@jtopjian you're right there are some valid use cases. I guess for me it just comes down to having dhcp off will silently bust a lot of other provider options very quietly -- like metadata and ip_fixed_v4. Thanks for taking the feedback - you guys are doing a great job!

@ghost
Copy link

ghost commented Apr 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants