@@ -81,15 +81,25 @@ func TestAccScalewayLbFrontend_Basic(t *testing.T) {
81
81
func TestAccScalewayLbFrontend_Certificate (t * testing.T ) {
82
82
tt := NewTestTools (t )
83
83
defer tt .Cleanup ()
84
+ testDNSZone := fmt .Sprintf ("test.%s" , testDomain )
84
85
resource .ParallelTest (t , resource.TestCase {
85
86
PreCheck : func () { testAccPreCheck (t ) },
86
87
ProviderFactories : tt .ProviderFactories ,
87
88
CheckDestroy : testAccCheckScalewayLbFrontendDestroy (tt ),
88
89
Steps : []resource.TestStep {
89
90
{
90
- Config : `
91
+ Config : fmt . Sprintf ( `
91
92
resource scaleway_lb_ip ip01 {}
92
93
94
+ resource "scaleway_domain_record" "tf_A" {
95
+ dns_zone = %[1]q
96
+ name = "test"
97
+ type = "A"
98
+ data = "${scaleway_lb_ip.ip01.ip_address}"
99
+ ttl = 3600
100
+ priority = 1
101
+ }
102
+
93
103
resource scaleway_lb lb01 {
94
104
ip_id = scaleway_lb_ip.ip01.id
95
105
name = "test-lb"
@@ -98,8 +108,8 @@ func TestAccScalewayLbFrontend_Certificate(t *testing.T) {
98
108
99
109
resource scaleway_lb_backend bkd01 {
100
110
lb_id = scaleway_lb.lb01.id
101
- forward_protocol = "tcp "
102
- forward_port = 443
111
+ forward_protocol = "http "
112
+ forward_port = 80
103
113
proxy_protocol = "none"
104
114
}
105
115
@@ -111,18 +121,27 @@ func TestAccScalewayLbFrontend_Certificate(t *testing.T) {
111
121
}
112
122
}
113
123
124
+ resource scaleway_lb_certificate cert02 {
125
+ lb_id = scaleway_lb.lb01.id
126
+ name = "test-cert-front-end2"
127
+ letsencrypt {
128
+ common_name = %[2]q
129
+ }
130
+ }
131
+
114
132
resource scaleway_lb_frontend frt01 {
115
133
lb_id = scaleway_lb.lb01.id
116
134
backend_id = scaleway_lb_backend.bkd01.id
117
- inbound_port = 443
118
- certificate_ids = [scaleway_lb_certificate.cert01.id]
135
+ inbound_port = 80
136
+ certificate_ids = [scaleway_lb_certificate.cert01.id, scaleway_lb_certificate.cert02.id ]
119
137
}
120
- ` ,
138
+ ` , testDomain , testDNSZone ),
121
139
Check : resource .ComposeTestCheckFunc (
122
140
testAccCheckScalewayLbFrontendExists (tt , "scaleway_lb_frontend.frt01" ),
123
141
testAccCheckScalewayFrontendCertificateExist (tt , "scaleway_lb_frontend.frt01" , "scaleway_lb_certificate.cert01" ),
142
+ testAccCheckScalewayFrontendCertificateExist (tt , "scaleway_lb_frontend.frt01" , "scaleway_lb_certificate.cert02" ),
124
143
resource .TestCheckResourceAttr ("scaleway_lb_frontend.frt01" ,
125
- "certificate_ids.#" , "1 " ),
144
+ "certificate_ids.#" , "2 " ),
126
145
),
127
146
},
128
147
},
0 commit comments