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

resource/aws_ami_launch_permission: Prevent panic reading public permissions #6224

Merged
merged 2 commits into from
Oct 30, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Oct 19, 2018

Fixes #6222

Changes proposed in this pull request:

  • Dereference via AWS Go SDK helper instead of using * since the field might not exist
  • Also parallelizes other cases of removing launch permissions and AMI.

Previously:

=== CONT  TestAccAWSAMILaunchPermission_Disappears_LaunchPermission_Public
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2abb7a7]

goroutine 1240 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.hasLaunchPermission(0xc00000e1e0, 0xc0009a2240, 0x15, 0xc0007aa480, 0xc, 0xc0005c8000, 0xc00099b700, 0x1870888)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ami_launch_permission.go:109 +0x137
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsAmiLaunchPermissionExists(0xc0005c8000, 0x3e0b7e0, 0xc000c26300, 0xc0005c8000, 0x0, 0x0)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ami_launch_permission.go:41 +0x101

Now:

--- PASS: TestAccAWSAMILaunchPermission_Disappears_LaunchPermission (335.48s)
--- PASS: TestAccAWSAMILaunchPermission_Disappears_LaunchPermission_Public (345.99s)
--- PASS: TestAccAWSAMILaunchPermission_Basic (346.17s)
--- PASS: TestAccAWSAMILaunchPermission_Disappears_AMI (353.34s)

@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service. labels Oct 19, 2018
@bflad bflad requested a review from a team October 19, 2018 20:22
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Oct 19, 2018
@bflad bflad mentioned this pull request Oct 19, 2018
… omission panic

Also parallelizes other cases of removing launch permissions and AMI.

Previously:

```
=== CONT  TestAccAWSAMILaunchPermission_Disappears_LaunchPermission_Public
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2abb7a7]

goroutine 1240 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.hasLaunchPermission(0xc00000e1e0, 0xc0009a2240, 0x15, 0xc0007aa480, 0xc, 0xc0005c8000, 0xc00099b700, 0x1870888)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ami_launch_permission.go:109 +0x137
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsAmiLaunchPermissionExists(0xc0005c8000, 0x3e0b7e0, 0xc000c26300, 0xc0005c8000, 0x0, 0x0)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ami_launch_permission.go:41 +0x101
```

Now:

```
--- PASS: TestAccAWSAMILaunchPermission_Disappears_LaunchPermission (335.48s)
--- PASS: TestAccAWSAMILaunchPermission_Disappears_LaunchPermission_Public (345.99s)
--- PASS: TestAccAWSAMILaunchPermission_Basic (346.17s)
--- PASS: TestAccAWSAMILaunchPermission_Disappears_AMI (353.34s)
```
@ghost ghost added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Oct 19, 2018
@bflad
Copy link
Contributor Author

bflad commented Oct 19, 2018

I have added acceptance testing which now covers the panic.

@bflad bflad changed the title resource/aws_ami_launch_permission: Prevent panic reading permissions resource/aws_ami_launch_permission: Prevent panic reading public permissions Oct 19, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bflad bflad added this to the v1.42.0 milestone Oct 30, 2018
@bflad bflad merged commit 86021a1 into master Oct 30, 2018
@bflad bflad deleted the b-aws_ami_launch_permission-prevent-panic branch October 30, 2018 12:58
bflad added a commit that referenced this pull request Oct 30, 2018
@bflad
Copy link
Contributor Author

bflad commented Nov 1, 2018

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

@ghost
Copy link

ghost commented Apr 2, 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 Apr 2, 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. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service. size/L 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.

Terraform crash on plan
2 participants