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

provider/aws: fix panic when route has no cidr_block #2215

Merged
merged 1 commit into from
Jun 3, 2015

Conversation

phinze
Copy link
Contributor

@phinze phinze commented Jun 3, 2015

While cidr_block is required for static route creation, there are
apparently cases (involving some combination of VPNs, Customer Gateways,
and automatic route propogation) where the cidr_block can come back nil.
This means we cannot assume it's there in the set hash calculation.

@@ -361,7 +361,10 @@ func resourceAwsRouteTableDelete(d *schema.ResourceData, meta interface{}) error
func resourceAwsRouteTableHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["cidr_block"].(string)))

if v, ok := m["cidr_block"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

doest this need to check for v.(string) != "" as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh whoops - didn't change next line to use v - this would technically work but it's silly.

empty string is fine - you'll just generate a hash from the string w/ two dashes in it

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, at least gets around nil pointer 👍

@catsby
Copy link
Contributor

catsby commented Jun 3, 2015

🚀

@phinze phinze force-pushed the b-route-cidr-block-optional branch from ccfe468 to cd434c3 Compare June 3, 2015 18:25
@ryanuber
Copy link
Member

ryanuber commented Jun 3, 2015

LGTM! 👍

While cidr_block is required for static route creation, there are
apparently cases (involving some combination of VPNs, Customer Gateways,
and automatic route propogation) where the cidr_block can come back nil.
This means we cannot assume it's there in the set hash calculation.
@phinze phinze force-pushed the b-route-cidr-block-optional branch from cd434c3 to 1caef30 Compare June 3, 2015 18:44
phinze added a commit that referenced this pull request Jun 3, 2015
provider/aws: fix panic when route has no cidr_block
@phinze phinze merged commit 328db1c into master Jun 3, 2015
@phinze phinze deleted the b-route-cidr-block-optional branch June 3, 2015 19:19
@ghost
Copy link

ghost commented May 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 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.

@ghost ghost locked and limited conversation to collaborators May 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants