@@ -18,6 +18,7 @@ const bindingProtocolKey = "protocol"
1818const bindingPortKey = "port"
1919const bindingAddressKey = "ip_address"
2020const bindingHostKey = "hostname"
21+ const bindingCertificateId = "certificate"
2122
2223func resourceWebsite () * schema.Resource {
2324 return & schema.Resource {
@@ -70,6 +71,10 @@ var bindingSchema = &schema.Resource{
7071 Type : schema .TypeString ,
7172 Optional : true ,
7273 },
74+ bindingCertificateId : {
75+ Type : schema .TypeString ,
76+ Optional : true ,
77+ },
7378 },
7479}
7580
@@ -149,12 +154,16 @@ func getBindings(b *schema.Set) []iis.WebsiteBinding {
149154 port := binding [bindingPortKey ].(int )
150155 ipAddress := binding [bindingAddressKey ].(string )
151156 hostname := binding [bindingHostKey ].(string )
157+ id := binding [bindingCertificateId ].(string )
152158
153159 bindings [i ] = iis.WebsiteBinding {
154160 Port : port ,
155161 IPAddress : ipAddress ,
156162 Hostname : hostname ,
157163 Protocol : protocol ,
164+ Certificate : iis.BindingCertificate {
165+ ID : id ,
166+ },
158167 }
159168 }
160169
@@ -165,10 +174,11 @@ func mapBindingsToSet(site *iis.Website) *schema.Set {
165174 var bindings []interface {}
166175 for _ , binding := range site .Bindings {
167176 bindings = append (bindings , map [string ]interface {}{
168- bindingProtocolKey : binding .Protocol ,
169- bindingAddressKey : binding .IPAddress ,
170- bindingPortKey : binding .Port ,
171- bindingHostKey : binding .Hostname ,
177+ bindingProtocolKey : binding .Protocol ,
178+ bindingAddressKey : binding .IPAddress ,
179+ bindingPortKey : binding .Port ,
180+ bindingHostKey : binding .Hostname ,
181+ bindingCertificateId : binding .Certificate .ID ,
172182 })
173183 }
174184 set := schema .NewSet (hashBinding , bindings )
@@ -181,6 +191,7 @@ func hashBinding(v interface{}) int {
181191 protocol := schema .HashString (bindingMap [bindingProtocolKey ].(string ))
182192 port := schema .HashInt (bindingMap [bindingPortKey ].(int ))
183193 hostname := schema .HashString (bindingMap [bindingHostKey ].(string ))
194+ certificateId := schema .HashString (bindingMap [bindingCertificateId ].(string ))
184195
185- return address + protocol + port + hostname
196+ return address + protocol + port + hostname + certificateId
186197}
0 commit comments