-
Notifications
You must be signed in to change notification settings - Fork 64
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
Virtual network gateway #31
Conversation
There was a problem hiding this 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, | ||
}, |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
azurestack/test_utils.go
Outdated
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) |
There was a problem hiding this comment.
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?
azurestack/test_utils.go
Outdated
return "", "", fmt.Errorf("Not found: %s", name) | ||
} | ||
|
||
armName := rs.Primary.Attributes["name"] |
There was a problem hiding this comment.
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
azurestack/validators.go
Outdated
return | ||
} | ||
|
||
func evaluateSchemaValidateFunc(i interface{}, k string, validateFunc schema.SchemaValidateFunc) (bool, error) { |
There was a problem hiding this comment.
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?
Backported comments to AzureRM here |
Also i recommend merging from master as validate & suppress are now vended in from AzureRm |
ae8438b
to
ace1b69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes! LGTM now 💯
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! |
No description provided.