maintenance/aws-janitor/resources/dhcp_options.go
func defaultLookingDHCPOptions(dhcp *ec2.DhcpOptions, region string) bool {
	if len(dhcp.Tags) != 0 {
		return false
	}

	for _, conf := range dhcp.DhcpConfigurations {
		switch *conf.Key {
		case "domain-name":
			var domain string
			// TODO(akutz): Should this be updated to regions.Default, or is
			// this relying on the default region for EC2 for North America?
			// Because EC2's default region changed from us-east-1 to us-east-2
			// depending on when the account was created.
			if region == "us-east-1" {
				domain = "ec2.internal"
			} else {
				domain = region + ".compute.internal"
			}

			// TODO(vincepri): Investigate this line, seems it might segfault if conf.Values is 0?
			if len(conf.Values) != 1 || *conf.Values[0].Value != domain {
				return false
			}
		case "domain-name-servers":
			// TODO(vincepri): Same as above.
			if len(conf.Values) != 1 || *conf.Values[0].Value != "AmazonProvidedDNS" {
				return false
			}
		default:
			return false
		}
	}

	return true
}
func defaultLookingDHCPOptions(dhcp *ec2.DhcpOptions, region string) bool {
	if len(dhcp.Tags) != 0 {
		return false
	}

	for _, conf := range dhcp.DhcpConfigurations {
		switch *conf.Key {
		case "domain-name":
			var domain string
			// TODO(akutz): Should this be updated to regions.Default, or is
			// this relying on the default region for EC2 for North America?
			// Because EC2's default region changed from us-east-1 to us-east-2
			// depending on when the account was created.
			if region == "us-east-1" {
				domain = "ec2.internal"
			} else {
				domain = region + ".compute.internal"
			}

			// TODO(vincepri): Investigate this line, seems it might segfault if conf.Values is 0?
			if len(conf.Values) != 1 || *conf.Values[0].Value != domain {
				return false
			}
		case "domain-name-servers":
			// TODO(vincepri): Same as above.
			if len(conf.Values) != 1 || *conf.Values[0].Value != "AmazonProvidedDNS" {
				return false
			}
		default:
			return false
		}
	}

	return true
}
// defaultLookingDHCPOptions: This part is a little annoying. If
// you're running in a region with where there is no default-looking
// DHCP option set, when you create any VPC, AWS will create a
// default-looking DHCP option set for you. If you then re-associate
// or delete the VPC, the option set will hang around. However, if you
// have a default-looking DHCP option set (even with no default VPC)
// and create a VPC, AWS will associate the VPC with the DHCP option
// set of the default VPC. There's no signal as to whether the option
// set returned is the default or was created along with the
// VPC. Because of this, we just skip these during cleanup - there
// will only ever be one default set per region.