-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New Resource: Azure Front Door #3933
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.
Thanks for the PR @jeffreyCline,
Overall this looks really good, i've left a bunch of mostly minor comments inline that once addressed this should be good to go 👍
azurerm/resource_arm_front_door.go
Outdated
ID: id, | ||
Name: utils.String(name), | ||
FrontendEndpointProperties: &frontdoor.FrontendEndpointProperties{ | ||
// ResourceState: |
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.
What is the point of these comments 🤔
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.
I put them there to show which attributes are in the structure that I have omitted from terraform, it made it easier to keep straight in my head when I was comparing the SDK structs to what I implemented within Terraform.
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.
I suggest either removing them or adding a comment to that effect then
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.
I have removed them.
Co-Authored-By: kt <kt@katbyte.me>
Co-Authored-By: kt <kt@katbyte.me>
Co-Authored-By: kt <kt@katbyte.me>
Co-Authored-By: kt <kt@katbyte.me>
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.
Thanks for the changes @jeffreyCline,
Going through this once more, the main thing that stands out is the passing multiple parameters down the stack when we could generate the front door ID once and pass it down instead. I think this would clean up the code a bunch and make it easier to follow.
@@ -0,0 +1,85 @@ | |||
package helper |
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 just move this one up into the front door package?
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.
I tried moving it but go got confused with the path.
@@ -0,0 +1,172 @@ | |||
package validate |
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 just move this one up into the front door package?
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.
I tried moving it but go got confused with the path.
) | ||
|
||
//Frontdoor name must begin with a letter or number, end with a letter or number and may contain only letters, numbers or hyphens. | ||
func FrontDoorName(i interface{}, k string) (_ []string, errors []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.
This would then become
func FrontDoorName(i interface{}, k string) (_ []string, errors []error) { | |
func ValidateFrontDoorName(i interface{}, k string) (_ []string, errors []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.
Yep. Fixed.
return nil, errors | ||
} | ||
|
||
func BackendPoolRoutingRuleName(i interface{}, k string) (_ []string, errors []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.
func BackendPoolRoutingRuleName(i interface{}, k string) (_ []string, errors []error) { | |
func ValidateBackendPoolRoutingRuleName(i interface{}, k string) (_ []string, errors []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.
Yep, Fixed.
azurerm/resource_arm_front_door.go
Outdated
} | ||
d.Set("friendly_name", properties.FriendlyName) | ||
|
||
if frontDoorFrontendEndpoints, err := flattenArmFrontDoorFrontendEndpoint(properties.FrontendEndpoints, resourceGroup, *resp.Name, meta); frontDoorFrontendEndpoints != nil { |
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.
I think we should be nil checking resp.name here?
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.
Sure, fixed.
} | ||
|
||
output := make([]map[string]interface{}, 0) | ||
|
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.
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.
Fixed.
azurerm/resource_arm_front_door.go
Outdated
result["host_header"] = *backendHostHeader | ||
} | ||
|
||
if v.EnabledState == frontdoor.Enabled { |
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.
We should replace this with:
if v.EnabledState == frontdoor.Enabled { | |
result["enabled"] = v.EnabledState == frontdoor.Enabled |
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.
Fixed.
azurerm/resource_arm_front_door.go
Outdated
} | ||
} | ||
|
||
//result["web_application_firewall_policy_link"] = flattenArmFrontDoorFrontendEndpointUpdateParameters_webApplicationFirewallPolicyLink(properties.WebApplicationFirewallPolicyLink) |
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.
We should remove this comment ?
//result["web_application_firewall_policy_link"] = flattenArmFrontDoorFrontendEndpointUpdateParameters_webApplicationFirewallPolicyLink(properties.WebApplicationFirewallPolicyLink) |
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.
Fixed.
azurerm/resource_arm_front_door.go
Outdated
} | ||
|
||
func expandArmFrontDoorSubResource(subscriptionId string, resourceGroup string, frontDoorName string, resourceType string, resourceName string) *frontdoor.SubResource { | ||
result := frontdoor.SubResource{ |
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.
Instead of having this function could we just assign frontdoor.SubResource
inline so its clear what is going on?
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.
Sure, fixed.
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.
Thanks for the revisions @jeffreyCline, LGTM 👍
This has been released in version 1.34.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.34.0"
}
# ... other configuration ... |
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
Adding support for Azure Frontdoor Service
[fixes: #3186]