Skip to content

Commit 5ef427b

Browse files
authored
Merge pull request #6 from Ouest-France/errorPageAndMsg
Add error_page and error_msg args to virtual server resource
2 parents 8a2c6ea + ce43a5a commit 5ef427b

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ resource "fortiadc_loadbalance_virtual_server" "myvirtualserver" {
209209
| `pool` | Pool name | String | true | |
210210
| `client_ssl_profile` | Client SSL profile | String | false | ` ` |
211211
| `http_to_https` | Redirect HTTP to HTTPS when L7 | Bool | false | `false` |
212+
| `error_msg` | Error message on backend failure | String | false | `Server-unavailable!` |
213+
| `error_page` | Error page on backend failure | String | false | `` |
212214

213215
#### Attributes
214216

fortiadc/resource_fortiadc_loadbalance_virtual_server.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ func resourceFortiadcLoadbalanceVirtualServer() *schema.Resource {
8686
Optional: true,
8787
Default: 0,
8888
},
89+
"error_page": &schema.Schema{
90+
Type: schema.TypeString,
91+
Optional: true,
92+
Default: "",
93+
},
94+
"error_msg": &schema.Schema{
95+
Type: schema.TypeString,
96+
Optional: true,
97+
Default: "Server-unavailable!",
98+
},
8999
"interface": &schema.Schema{
90100
Type: schema.TypeString,
91101
Optional: true,
@@ -202,6 +212,8 @@ func resourceFortiadcLoadbalanceVirtualServerCreate(d *schema.ResourceData, m in
202212
Pool: d.Get("pool").(string),
203213
ClientSSLProfile: d.Get("client_ssl_profile").(string),
204214
HTTP2HTTPS: http2https,
215+
ErrorMsg: d.Get("error_msg").(string),
216+
ErrorPage: d.Get("error_page").(string),
205217
}
206218

207219
err := client.LoadbalanceCreateVirtualServer(req)
@@ -269,6 +281,8 @@ func resourceFortiadcLoadbalanceVirtualServerRead(d *schema.ResourceData, m inte
269281
d.Set("pool", rs.Pool)
270282
d.Set("client_ssl_profile", rs.ClientSSLProfile)
271283
d.Set("http_to_https", http2https)
284+
d.Set("error_msg", rs.ErrorMsg)
285+
d.Set("error_page", rs.ErrorPage)
272286

273287
port, err := strconv.ParseInt(strings.TrimSpace(rs.Port), 10, 64)
274288
if err != nil {
@@ -374,6 +388,8 @@ func resourceFortiadcLoadbalanceVirtualServerUpdate(d *schema.ResourceData, m in
374388
Pool: d.Get("pool").(string),
375389
ClientSSLProfile: d.Get("client_ssl_profile").(string),
376390
HTTP2HTTPS: http2https,
391+
ErrorMsg: d.Get("error_msg").(string),
392+
ErrorPage: d.Get("error_page").(string),
377393
}
378394

379395
err := client.LoadbalanceUpdateVirtualServer(req)

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
5858
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
5959
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
6060
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
61+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6162
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6263
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
6364
github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
@@ -192,6 +193,7 @@ github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nr
192193
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
193194
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
194195
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
196+
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
195197
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
196198
github.com/mitchellh/go-linereader v0.0.0-20190213213312-1b945b3263eb/go.mod h1:OaY7UOoTkkrX3wRwjpYRKafIkkyeD0UtweSHAWWiqQM=
197199
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
@@ -201,6 +203,7 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX
201203
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
202204
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
203205
github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
206+
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
204207
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
205208
github.com/mitchellh/panicwrap v0.0.0-20190213213626-17011010aaa4/go.mod h1:YYMf4xtQnR8LRC0vKi3afvQ5QwRPQ17zjcpkBCufb+I=
206209
github.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo=

0 commit comments

Comments
 (0)