Terraform: aws_vpc_dhcp_options does not return ID

Created on 16 Nov 2016  ·  4Comments  ·  Source: hashicorp/terraform

Terraform Version

Terraform v0.7.10

Affected Resource(s)

aws_vpc_dhcp_options

Terraform Configuration Files

source "aws_vpc_dhcp_options" "dns_resolver" {
    domain_name = "${var.dhcp_options_domain_name}"
    domain_name_servers = ["${var.dhcp_options_dns_servers}"]
    ntp_servers = ["${var.dhcp_options_dns_servers}"]
    #netbios_name_servers = ["127.0.0.1"]
    #netbios_node_type = 2

    tags{ 
        Name = "eCP Shared Services"
    }
}
output "aws_vpc_dhcp_options_ID" {
  value = "${aws_vpc_dhcp_options.dns_resolver.id}"
}

Debug Output

module root: 2 error(s) occurred:

  • Unknown root level key: source
  • output 'aws_vpc_dhcp_options_ID': unknown resource 'aws_vpc_dhcp_options.dns_resolver' referenced in variable aws_vpc_dhcp_options.dns_resolver.id

Expected Behavior

DHCP Options should be set, and return the ID associated with it.

Actual Behavior

Error occured, as above.

Steps to Reproduce

  1. terraform plan

next steps

I was originally trying to consume the ID in the following:
resource "aws_vpc_dhcp_options_association" "vpc_dhcp_options_association_ecp" { vpc_id = "${aws_vpc.main.id}" dhcp_options_id = "${aws_vpc_dhcp_options.dns_resolver.id}" }

bug provideaws

Most helpful comment

Hey @mcraig88

Looking at your first error, i.e. unknown root level key: source, it seems that you are missing the re part in the object type, i.e resource instead of source. So from:

source "aws_vpc_dhcp_options" "dns_resolver" {

Could you change to

resource "aws_vpc_dhcp_options" "dns_resolver" {

?

All 4 comments

Hey @mcraig88

Looking at your first error, i.e. unknown root level key: source, it seems that you are missing the re part in the object type, i.e resource instead of source. So from:

source "aws_vpc_dhcp_options" "dns_resolver" {

Could you change to

resource "aws_vpc_dhcp_options" "dns_resolver" {

?

Oh! Thank you that fixed it. What a noob mistake. Bet you wish all bugs
were this easy to resolve.

Thanks again.

Mike

On Thu, Nov 17, 2016 at 12:41 AM, Ninir [email protected] wrote:

Hey @mcraig88 https://github.com/mcraig88

Looking at your first error, i.e. unknown root level key: source, it
seems that you are missing the re part in this. So from:

source "aws_vpc_dhcp_options" "dns_resolver" {

Could you change to

resource "aws_vpc_dhcp_options" "dns_resolver" {

?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/hashicorp/terraform/issues/10163#issuecomment-261187584,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIFybTJo33J5DNJ1rRlbovbYDuCVDQFJks5q_BMkgaJpZM4K0Itc
.

Thanks @Ninir for helping with this - @mcraig88 closing this out :)

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.

Was this page helpful?
0 / 5 - 0 ratings