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

d/aws_nat_gateway: Add missing address attributes to the schema #2209

Merged
merged 2 commits into from Nov 21, 2017
Merged

d/aws_nat_gateway: Add missing address attributes to the schema #2209

merged 2 commits into from Nov 21, 2017

Conversation

darend
Copy link
Contributor

@darend darend commented Nov 7, 2017

what

Include Address attributes in NAT Gateway data source

why

Address attributes were not listed in the schema which prevented them from being referenced

Sample TF Project

provider "aws" {
  region  = "${var.region}"
  version = ">=1.2.0"
}

data "aws_nat_gateway" "default" {
    id = "${var.nat_id}"
}

output "subnet_id" {
    value = "${data.aws_nat_gateway.default.subnet_id}"
}

output "private_ip" {
    value = "${data.aws_nat_gateway.default.private_ip}"
}

Running terraform with DEBUG logging I see this warning:

2017/11/07 13:04:19 [WARN] Output interpolation "private_ip" failed: Resource 'data.aws_nat_gateway.default' does not have attribute 'private_ip' for variable 'data.aws_nat_gateway.default.private_ip'

See #1294 (comment)

* address attributes were not listed in the schema which prevented them from being referenced
@Ninir Ninir added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 8, 2017
@tomelliff
Copy link
Contributor

This just bit me and was trying to work out why the aws_nat_gateway data source wasn't exporting the public_ip as the docs suggested until I saw the schema.

I've not built this from your branch but it might be worth expanding the acceptance test to make sure that these attributes actually are exported.

@radeksimko radeksimko added the size/S Managed by automation to categorize the size of a PR. label Nov 15, 2017
@darend
Copy link
Contributor Author

darend commented Nov 16, 2017

I've not built this from your branch but it might be worth expanding the acceptance test to make sure that these attributes actually are exported.

👍 Ill look for an example

@radeksimko radeksimko added bug Addresses a defect in current functionality. waiting-response Maintainers are waiting on response from community or contributor. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Nov 16, 2017
@radeksimko radeksimko changed the title Include Address attributes in NAT Gateway data source d/aws_nat_gateway: Add missing address attributes to the schema Nov 16, 2017
@radeksimko
Copy link
Member

@darend Thanks for the PR, as @tomelliff mentioned having acceptance test would be incredibly helpful.

See this example:

https://github.com/terraform-providers/terraform-provider-aws/blob/b8d4e1570fc43a2acee6b6e47f63c9db6b067fa2/aws/data_source_aws_db_instance_test.go#L11-L29

It's ok to just add TestCheckResourceAttrSet to any existing acceptance test.

@darend
Copy link
Contributor Author

darend commented Nov 16, 2017

@radeksimko test updated and passed:

> make testacc TESTARGS='-run=TestAccDataSourceAwsNatGateway'           ✓

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDataSourceAwsNatGateway -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccDataSourceAwsNatGateway
--- PASS: TestAccDataSourceAwsNatGateway (219.30s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	219.335s

Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @darend

This looks very good to me, thanks for the work! 👍 🚀

$ make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsNatGateway'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAwsNatGateway -timeout 120m
=== RUN   TestAccDataSourceAwsNatGateway
	--- PASS: TestAccDataSourceAwsNatGateway (258.06s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	258.102s

@Ninir Ninir removed the waiting-response Maintainers are waiting on response from community or contributor. label Nov 21, 2017
@Ninir Ninir merged commit e97ad73 into hashicorp:master Nov 21, 2017
@ghost
Copy link

ghost commented Apr 10, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants