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

Reverting the change to make Nested security rules from List to Set. … #893

Merged
merged 3 commits into from
Mar 1, 2018

Conversation

VaijanathB
Copy link
Contributor

@VaijanathB VaijanathB commented Feb 26, 2018

This had caused regression #455. I have verified that resources created after 0.3.1 also work properly once we revert this changes.
I have locally run all the tests using the following command and all the tests pass.
make testacc TEST=./azurerm TESTARGS="-run=TestAccAzureRMNetwork"

Also I have verified that Issue #455 is resolved when we make this change.

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.

hey @VaijanathB

Thanks for this PR - I've taken a look through and left a couple of comments in-line but this mostly LGTM. If we can sort the two minor issues this should be good to merge.

Thanks!

buf.WriteString(fmt.Sprintf("%s-", m["destination_address_prefix"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["access"].(string)))
buf.WriteString(fmt.Sprintf("%d-", m["priority"].(int)))
buf.WriteString(fmt.Sprintf("%s-", m["direction"].(string)))
Copy link
Contributor

Choose a reason for hiding this comment

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

since all items are contained within the Set's hash function, we actually don't need to specify this function at all - so can we remove this method? the default set hash function will include all values in the set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. removed this function.

}

func flattenNetworkSecurityRules(rules *[]network.SecurityRule) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(*rules))
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a crash here is rules is nil - can we make this:

result := make([]map[string]interface{}, 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it.

@VaijanathB
Copy link
Contributor Author

I have addressed both of these comments. I also reran all the Network Acceptance test locally and they pass with this change.

@tombuildsstuff
Copy link
Contributor

I've rebased this - tests pass:

screen shot 2018-03-01 at 14 33 24

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 👍

@tombuildsstuff tombuildsstuff merged commit 403977a into master Mar 1, 2018
@tombuildsstuff tombuildsstuff deleted the Fix455NetworkSecurityRulesIssue branch March 1, 2018 22:45
@tombuildsstuff
Copy link
Contributor

@VaijanathB has confirmed the upgrade path from both 0.2.x -> this branch & 1.1.2 -> this branch

@franciscocabral
Copy link

I don't know where I should comment this, but the docs need to be updated.

@tombuildsstuff
Copy link
Contributor

@franciscocabral would you mind opening a new issue about that with some more information about what needs to be updated? Thanks! :)

@hashicorp hashicorp locked as off-topic and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants