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

Virtual network gateway #31

Merged
merged 18 commits into from
Sep 7, 2018

Conversation

thetonymaster
Copy link
Contributor

No description provided.

@ghost ghost added the size/XXL label Aug 23, 2018
@katbyte katbyte added this to the 0.4.0 milestone Sep 6, 2018
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @thetonymaster,

Thank you for the PR, I have left some comments inline with my primary concern being evaluateSchemaValidateFunc. It seems to be the only function in that file required for the PR, as well as only used by this resource.

I think we should move it out into the resource file for now and in the future if something else uses it move it somewhere shared.

Otherwise my other comments are of the usual validation and cosmetic variety.

"name": {
Type: schema.TypeString,
Required: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we get a ValidateFunc: validation.NoZeroValues, here?

Type: schema.TypeString,
Computed: true,
},
"private_ip_address_allocation": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we get spaces between the properties to better mach the other resources:

                        "name": {
							Type:     schema.TypeString,
							Computed: true,
						},

						"private_ip_address_allocation": {
                            Type:     schema.TypeString,
							Computed: true,
						},
``


d.Set("type", string(gw.GatewayType))
d.Set("enable_bgp", gw.EnableBgp)
//d.Set("active_active", gw.ActiveActive)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is commented out because it is not supported in stack yet, a comment explaining would be great.

}
flat["revoked_certificate"] = schema.NewSet(hashVirtualNetworkGatewayDataSourceRevokedCert, revokedCerts)

// vpnClientProtocols := &schema.Set{F: schema.HashString}
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above, a comment explaining why this is commented out would be great.


```hcl
resource "azurestack_resource_group" "test" {
name = "test"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we align these assignments?

},
VpnClientRootCertificates: &rootCerts,
VpnClientRevokedCertificates: &revokedCerts,
// VpnClientProtocols: &vpnClientProtocols,
Copy link
Collaborator

Choose a reason for hiding this comment

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

As mentioned above

}
flat["revoked_certificate"] = schema.NewSet(hashVirtualNetworkGatewayRevokedCert, revokedCerts)

// vpnClientProtocols := &schema.Set{F: schema.HashString}
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above.

armName := rs.Primary.Attributes["name"]
armResourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"]
if !hasResourceGroup {
return "", "", fmt.Errorf("Bad: no resource group found in state for virtual network gateway: %s", name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this is a generic function, could we update the error message?

return "", "", fmt.Errorf("Not found: %s", name)
}

armName := rs.Primary.Attributes["name"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be best to also check here for hasName? as well as that name is not empty

return
}

func evaluateSchemaValidateFunc(i interface{}, k string, validateFunc schema.SchemaValidateFunc) (bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Checking AzureRm it also appears this is only used by the network gateway resource, so could we rename it and move it to that resource's file?

This appears to be the only function in this file actually required by the PR, so could we then remove it/the rest?

@katbyte
Copy link
Collaborator

katbyte commented Sep 7, 2018

Backported comments to AzureRM here

@katbyte
Copy link
Collaborator

katbyte commented Sep 7, 2018

Also i recommend merging from master as validate & suppress are now vended in from AzureRm

@ghost ghost added the size/XXL label Sep 7, 2018
@thetonymaster thetonymaster force-pushed the virtual-network-gateway branch from ae8438b to ace1b69 Compare September 7, 2018 20:18
@ghost ghost added the size/XXL label Sep 7, 2018
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

@thetonymaster,

Thank you for the changes! LGTM now 💯

@katbyte
Copy link
Collaborator

katbyte commented Sep 7, 2018

Tests pass:
screen shot 2018-09-07 at 13 58 39

@katbyte katbyte merged commit 0567f31 into hashicorp:master Sep 7, 2018
katbyte added a commit that referenced this pull request Sep 7, 2018
@ghost
Copy link

ghost commented Jun 27, 2019

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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 27, 2019
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