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

Add VPC DHCP Options #286

Open
jen20 opened this issue May 27, 2019 · 0 comments
Open

Add VPC DHCP Options #286

jen20 opened this issue May 27, 2019 · 0 comments
Labels
kind/enhancement Improvements or new features

Comments

@jen20
Copy link
Contributor

jen20 commented May 27, 2019

It is common to configure a DHCP Options Set when creating a VPC, which allows DNS Servers, a custom search domain, NTP servers and a few other parameters to instances via the DHCP system built into the VPC control plane.

Currently the following function can be used to add an options set for a custom search domain.

function addDhcpOptions(namePrefix: string, baseTags: aws.Tags, zoneName: string, vpc: awsx.ec2.Vpc): pulumi.Output<string> {
    const privateZone = new aws.route53.Zone(`${namePrefix}-private-hosted-zone`, {
        vpcs: [{
            vpcId: vpc.id,
        }],
        name: zoneName,
        comment: `Private zone for ${zoneName}. Managed by Pulumi.`,
    }, {parent: vpc});

    const dhcpOptionSet = new aws.ec2.VpcDhcpOptions(`${namePrefix}-dhcp-options`, {
        domainName: privateZone.name,
        domainNameServers: ["AmazonProvidedDNS"],
        tags: Object.assign({
            Name: `DHCP Options (${zoneName})`,
        }, baseTags),
    }, vpc);

    new aws.ec2.VpcDhcpOptionsAssociation(`${namePrefix}-dhcp-options-assoc`, {
        vpcId: vpc.id,
        dhcpOptionsId: dhcpOptionSet.id,
    }, {parent: dhcpOptionSet});

    return privateZone.zoneId;
}

Note: the above program also creates the zone itself, which I do not believe should be done by the Vpc class.

It would be nice to allow a zone ID or name to be passed to the VpcArgs of awsx.ec2.Vpc in order that this can be done automatically, and that the zone ID can be exposed as one of the outputs of the Vpc instead of being passed around separately to create records on it.

@danielrbradley danielrbradley added the kind/enhancement Improvements or new features label May 9, 2022
@danielrbradley danielrbradley changed the title Allow configuring DHCP Options on awsx.ec2.Vpc Add VPC DHCP Options May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants