-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Adding the Match parameter to the Probes to check on the response code #1446
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0906516
Adding the Match parameter to the Probes to check on the response code
VaijanathB ebf4c1d
Added documentation
VaijanathB a5103a5
Incorporating code review comments from Tom
VaijanathB cdb8ff6
Merge branch 'master' of https://github.com/terraform-providers/terra…
VaijanathB 949e539
Removing an expectation where Match is optional
tombuildsstuff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -457,6 +457,29 @@ func resourceArmApplicationGateway() *schema.Resource { | |
Type: schema.TypeInt, | ||
Required: true, | ||
}, | ||
|
||
"match": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"body": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "*", | ||
}, | ||
|
||
"status_code": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. given this is a status code, can we make this a TypeInt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. People can specify status codes as ranges also like 200-300. |
||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
@@ -1162,6 +1185,22 @@ func expandApplicationGatewayProbes(d *schema.ResourceData) *[]network.Applicati | |
}, | ||
} | ||
|
||
matchConfigs := data["match"].([]interface{}) | ||
if len(matchConfigs) > 0 { | ||
match := matchConfigs[0].(map[string]interface{}) | ||
matchBody := match["body"].(string) | ||
|
||
statusCodes := make([]string, 0) | ||
for _, statusCode := range match["status_code"].([]interface{}) { | ||
statusCodes = append(statusCodes, statusCode.(string)) | ||
} | ||
|
||
setting.ApplicationGatewayProbePropertiesFormat.Match = &network.ApplicationGatewayProbeHealthResponseMatch{ | ||
Body: &matchBody, | ||
StatusCodes: &statusCodes, | ||
} | ||
} | ||
|
||
backendSettings = append(backendSettings, setting) | ||
} | ||
|
||
|
@@ -1608,6 +1647,22 @@ func flattenApplicationGatewayProbes(input *[]network.ApplicationGatewayProbe) [ | |
if threshold := props.UnhealthyThreshold; threshold != nil { | ||
settings["unhealthy_threshold"] = int(*threshold) | ||
} | ||
|
||
if match := props.Match; match != nil { | ||
matchConfig := map[string]interface{}{} | ||
if body := match.Body; body != nil { | ||
matchConfig["body"] = *body | ||
} | ||
|
||
statusCodes := make([]interface{}, 0) | ||
if match.StatusCodes != nil { | ||
for _, status := range *match.StatusCodes { | ||
statusCodes = append(statusCodes, status) | ||
} | ||
matchConfig["status_code"] = statusCodes | ||
} | ||
settings["match"] = matchConfig | ||
} | ||
} | ||
|
||
result = append(result, settings) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we also add documentation for this block?
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.
Added.