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

Fix for ebs_block_devices disappearing in data source, and fix instan… #10045

Merged
merged 2 commits into from
Nov 19, 2019

Conversation

ryndaniels
Copy link
Contributor

…ce data source tests

Note that this is in addition to the upstream fix.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #7198

Release note for CHANGELOG:

BUG FIXES:
* data_source/aws_instance: Fixes a bug where multiple EBS volumes would get collapsed and only one would return

Output from acceptance testing:

$ make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_ -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_basic
=== PAUSE TestAccAWSInstanceDataSource_basic
=== RUN   TestAccAWSInstanceDataSource_tags
=== PAUSE TestAccAWSInstanceDataSource_tags
=== RUN   TestAccAWSInstanceDataSource_AzUserData
=== PAUSE TestAccAWSInstanceDataSource_AzUserData
=== RUN   TestAccAWSInstanceDataSource_gp2IopsDevice
=== PAUSE TestAccAWSInstanceDataSource_gp2IopsDevice
=== RUN   TestAccAWSInstanceDataSource_blockDevices
=== PAUSE TestAccAWSInstanceDataSource_blockDevices
=== RUN   TestAccAWSInstanceDataSource_rootInstanceStore
=== PAUSE TestAccAWSInstanceDataSource_rootInstanceStore
=== RUN   TestAccAWSInstanceDataSource_getPasswordData_trueToFalse
=== PAUSE TestAccAWSInstanceDataSource_getPasswordData_trueToFalse
=== RUN   TestAccAWSInstanceDataSource_getPasswordData_falseToTrue
=== PAUSE TestAccAWSInstanceDataSource_getPasswordData_falseToTrue
=== RUN   TestAccAWSInstanceDataSource_GetUserData
=== PAUSE TestAccAWSInstanceDataSource_GetUserData
=== CONT  TestAccAWSInstanceDataSource_basic
=== CONT  TestAccAWSInstanceDataSource_tags
=== CONT  TestAccAWSInstanceDataSource_gp2IopsDevice
=== CONT  TestAccAWSInstanceDataSource_GetUserData
=== CONT  TestAccAWSInstanceDataSource_getPasswordData_falseToTrue
=== CONT  TestAccAWSInstanceDataSource_getPasswordData_trueToFalse
=== CONT  TestAccAWSInstanceDataSource_rootInstanceStore
=== CONT  TestAccAWSInstanceDataSource_AzUserData
=== CONT  TestAccAWSInstanceDataSource_blockDevices

--- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (115.32s)
--- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (116.65s)
--- PASS: TestAccAWSInstanceDataSource_blockDevices (138.49s)
--- PASS: TestAccAWSInstanceDataSource_tags (148.29s)
--- PASS: TestAccAWSInstanceDataSource_AzUserData (160.36s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (195.22s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (222.29s)
--- PASS: TestAccAWSInstanceDataSource_basic (237.58s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData (273.19s)


make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId
=== PAUSE TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId
=== CONT  TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId
--- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (149.66s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       150.558s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId
=== PAUSE TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId
=== CONT  TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId
--- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (161.15s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       162.033s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_GetUserData_NoUserData"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_GetUserData_NoUserData -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_GetUserData_NoUserData
=== PAUSE TestAccAWSInstanceDataSource_GetUserData_NoUserData
=== CONT  TestAccAWSInstanceDataSource_GetUserData_NoUserData
--- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (248.82s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       249.792s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_PlacementGroup"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_PlacementGroup -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_PlacementGroup
=== PAUSE TestAccAWSInstanceDataSource_PlacementGroup
=== CONT  TestAccAWSInstanceDataSource_PlacementGroup
--- PASS: TestAccAWSInstanceDataSource_PlacementGroup (142.39s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       143.360s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_VPC"==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_VPC -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_VPC
=== PAUSE TestAccAWSInstanceDataSource_VPC
=== RUN   TestAccAWSInstanceDataSource_VPCSecurityGroups
=== PAUSE TestAccAWSInstanceDataSource_VPCSecurityGroups
=== CONT  TestAccAWSInstanceDataSource_VPC
=== CONT  TestAccAWSInstanceDataSource_VPCSecurityGroups
--- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (143.59s)
--- PASS: TestAccAWSInstanceDataSource_VPC (146.47s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       147.350s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_privateIP"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_privateIP -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_privateIP
=== PAUSE TestAccAWSInstanceDataSource_privateIP
=== CONT  TestAccAWSInstanceDataSource_privateIP
--- PASS: TestAccAWSInstanceDataSource_privateIP (146.75s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       147.850s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_creditSpecification"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_creditSpecification -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_creditSpecification
=== PAUSE TestAccAWSInstanceDataSource_creditSpecification
=== CONT  TestAccAWSInstanceDataSource_creditSpecification
--- PASS: TestAccAWSInstanceDataSource_creditSpecification (154.20s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       155.101s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_SecurityGroups"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_SecurityGroups -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_SecurityGroups
=== PAUSE TestAccAWSInstanceDataSource_SecurityGroups
=== CONT  TestAccAWSInstanceDataSource_SecurityGroups
--- PASS: TestAccAWSInstanceDataSource_SecurityGroups (136.43s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       137.346s

make testacc TESTARGS="-run=TestAccAWSInstanceDataSource_keyPair"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSInstanceDataSource_keyPair -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSInstanceDataSource_keyPair
=== PAUSE TestAccAWSInstanceDataSource_keyPair
=== CONT  TestAccAWSInstanceDataSource_keyPair
--- PASS: TestAccAWSInstanceDataSource_keyPair (103.46s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       104.426s

@ryndaniels ryndaniels requested review from aeschright and a team September 9, 2019 15:57
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Sep 9, 2019
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Oct 8, 2019
… block contains only Computed attributes

Reference: hashicorp/terraform-provider-aws#7198
Reference: hashicorp/terraform-provider-aws#10045
Reference: hashicorp/terraform-provider-aws#10339
Reference: hashicorp/terraform#22719

When a resource schema contains the following:

```go
"config_block_attribute": {
	Type:     schema.TypeSet,
	Computed: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"attribute1": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"attribute2": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	},
},
```

The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
@@ -841,7 +885,7 @@ data "aws_ami" "amzn-ami-minimal-hvm-ebs" {

resource "aws_vpc" "test" {
cidr_block = "172.16.0.0/16"

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like some whitespace got added here and below on 897, 941, 950

Copy link
Contributor

@aeschright aeschright left a comment

Choose a reason for hiding this comment

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

Just need to rebase

--- PASS: TestAccAWSInstanceDataSource_creditSpecification (83.47s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData (109.88s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (108.75s)
--- PASS: TestAccAWSInstanceDataSource_SecurityGroups (126.30s)
--- PASS: TestAccAWSInstanceDataSource_PlacementGroup (73.58s)
--- PASS: TestAccAWSInstanceDataSource_VPC (112.64s)
--- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (84.25s)
--- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (88.44s)
--- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (98.38s)
--- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (88.85s)
--- PASS: TestAccAWSInstanceDataSource_basic (127.80s)
--- PASS: TestAccAWSInstanceDataSource_tags (127.90s)
--- PASS: TestAccAWSInstanceDataSource_AzUserData (128.13s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (161.39s)
--- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (67.84s)        
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (181.95s)
--- PASS: TestAccAWSInstanceDataSource_blockDevices (68.17s)
--- PASS: TestAccAWSInstanceDataSource_privateIP (196.68s)
--- PASS: TestAccAWSInstanceDataSource_keyPair (91.83s)

@ryndaniels ryndaniels force-pushed the rfd-instance-ebs-block-device branch from ec64659 to 869f103 Compare October 18, 2019 11:05
@ryndaniels ryndaniels force-pushed the rfd-instance-ebs-block-device branch from 869f103 to 89eca59 Compare October 18, 2019 13:00
@ryndaniels ryndaniels added this to the v2.39.0 milestone Nov 19, 2019
@ryndaniels ryndaniels merged commit 34ff52a into master Nov 19, 2019
@aeschright aeschright deleted the rfd-instance-ebs-block-device branch November 19, 2019 18:44
aeschright added a commit that referenced this pull request Nov 19, 2019
@ghost
Copy link

ghost commented Nov 21, 2019

This has been released in version 2.39.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

appilon pushed a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Feb 13, 2020
… block contains only Computed attributes

Reference: hashicorp/terraform-provider-aws#7198
Reference: hashicorp/terraform-provider-aws#10045
Reference: hashicorp/terraform-provider-aws#10339
Reference: hashicorp/terraform#22719

When a resource schema contains the following:

```go
"config_block_attribute": {
	Type:     schema.TypeSet,
	Computed: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"attribute1": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"attribute2": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	},
},
```

The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
appilon pushed a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Feb 13, 2020
… block contains only Computed attributes

Reference: hashicorp/terraform-provider-aws#7198
Reference: hashicorp/terraform-provider-aws#10045
Reference: hashicorp/terraform-provider-aws#10339
Reference: hashicorp/terraform#22719

When a resource schema contains the following:

```go
"config_block_attribute": {
	Type:     schema.TypeSet,
	Computed: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"attribute1": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"attribute2": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	},
},
```

The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
appilon pushed a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Feb 20, 2020
… block contains only Computed attributes

Reference: hashicorp/terraform-provider-aws#7198
Reference: hashicorp/terraform-provider-aws#10045
Reference: hashicorp/terraform-provider-aws#10339
Reference: hashicorp/terraform#22719

When a resource schema contains the following:

```go
"config_block_attribute": {
	Type:     schema.TypeSet,
	Computed: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"attribute1": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"attribute2": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	},
},
```

The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
appilon pushed a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Mar 4, 2020
… block contains only Computed attributes

Reference: hashicorp/terraform-provider-aws#7198
Reference: hashicorp/terraform-provider-aws#10045
Reference: hashicorp/terraform-provider-aws#10339
Reference: hashicorp/terraform#22719

When a resource schema contains the following:

```go
"config_block_attribute": {
	Type:     schema.TypeSet,
	Computed: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"attribute1": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"attribute2": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	},
},
```

The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
appilon pushed a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Mar 11, 2020
… block contains only Computed attributes

Reference: hashicorp/terraform-provider-aws#7198
Reference: hashicorp/terraform-provider-aws#10045
Reference: hashicorp/terraform-provider-aws#10339
Reference: hashicorp/terraform#22719

When a resource schema contains the following:

```go
"config_block_attribute": {
	Type:     schema.TypeSet,
	Computed: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"attribute1": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"attribute2": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	},
},
```

The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
@ghost
Copy link

ghost commented Mar 29, 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!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data sources don't return more than one TypeSet's
2 participants