diff options
Diffstat (limited to 'statuscake/resource_statuscakessl.go')
-rw-r--r-- | statuscake/resource_statuscakessl.go | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/statuscake/resource_statuscakessl.go b/statuscake/resource_statuscakessl.go index f07d6eb..2ee50e6 100644 --- a/statuscake/resource_statuscakessl.go +++ b/statuscake/resource_statuscakessl.go | |||
@@ -4,10 +4,10 @@ import ( | |||
4 | "fmt" | 4 | "fmt" |
5 | "strconv" | 5 | "strconv" |
6 | 6 | ||
7 | "log" | ||
8 | |||
9 | "github.com/DreamItGetIT/statuscake" | 7 | "github.com/DreamItGetIT/statuscake" |
10 | "github.com/hashicorp/terraform/helper/schema" | 8 | "github.com/hashicorp/terraform/helper/schema" |
9 | "log" | ||
10 | "strings" | ||
11 | ) | 11 | ) |
12 | 12 | ||
13 | func resourceStatusCakeSsl() *schema.Resource { | 13 | func resourceStatusCakeSsl() *schema.Resource { |
@@ -32,14 +32,18 @@ func resourceStatusCakeSsl() *schema.Resource { | |||
32 | }, | 32 | }, |
33 | 33 | ||
34 | "contact_groups": { | 34 | "contact_groups": { |
35 | Type: schema.TypeList, | 35 | Type: schema.TypeSet, |
36 | Elem: &schema.Schema{Type: schema.TypeString}, | 36 | Elem: &schema.Schema{Type: schema.TypeString}, |
37 | Computed: true, | 37 | Optional: true, |
38 | Computed: true, | ||
39 | ConflictsWith: []string{"contact_groups_c"}, | ||
38 | }, | 40 | }, |
39 | 41 | ||
40 | "contact_groups_c": { | 42 | "contact_groups_c": { |
41 | Type: schema.TypeString, | 43 | Type: schema.TypeString, |
42 | Required: true, | 44 | Optional: true, |
45 | Computed: true, | ||
46 | ConflictsWith: []string{"contact_groups"}, | ||
43 | }, | 47 | }, |
44 | 48 | ||
45 | "checkrate": { | 49 | "checkrate": { |
@@ -143,6 +147,10 @@ func resourceStatusCakeSsl() *schema.Resource { | |||
143 | func CreateSsl(d *schema.ResourceData, meta interface{}) error { | 147 | func CreateSsl(d *schema.ResourceData, meta interface{}) error { |
144 | client := meta.(*statuscake.Client) | 148 | client := meta.(*statuscake.Client) |
145 | 149 | ||
150 | if v, ok := d.GetOk("contact_groups"); ok { | ||
151 | d.Set("contact_groups_c", strings.Join(castSetToSliceStrings(v.(*schema.Set).List()), ",")) | ||
152 | } | ||
153 | |||
146 | newSsl := &statuscake.PartialSsl{ | 154 | newSsl := &statuscake.PartialSsl{ |
147 | Domain: d.Get("domain").(string), | 155 | Domain: d.Get("domain").(string), |
148 | Checkrate: strconv.Itoa(d.Get("checkrate").(int)), | 156 | Checkrate: strconv.Itoa(d.Get("checkrate").(int)), |
@@ -162,7 +170,6 @@ func CreateSsl(d *schema.ResourceData, meta interface{}) error { | |||
162 | } | 170 | } |
163 | 171 | ||
164 | d.Set("ssl_id", response.ID) | 172 | d.Set("ssl_id", response.ID) |
165 | d.Set("contact_groups", response.ContactGroups) | ||
166 | d.Set("paused", response.Paused) | 173 | d.Set("paused", response.Paused) |
167 | d.Set("issuer_cn", response.IssuerCn) | 174 | d.Set("issuer_cn", response.IssuerCn) |
168 | d.Set("cert_score", response.CertScore) | 175 | d.Set("cert_score", response.CertScore) |
@@ -253,7 +260,9 @@ func getStatusCakeSslInput(d *schema.ResourceData) *statuscake.PartialSsl { | |||
253 | ssl.Checkrate = strconv.Itoa(v.(int)) | 260 | ssl.Checkrate = strconv.Itoa(v.(int)) |
254 | } | 261 | } |
255 | 262 | ||
256 | if v, ok := d.GetOk("contact_groups_c"); ok { | 263 | if v, ok := d.GetOk("contact_groups"); ok { |
264 | ssl.ContactGroupsC = strings.Join(castSetToSliceStrings(v.(*schema.Set).List()), ",") | ||
265 | } else if v, ok := d.GetOk("contact_groups_c"); ok { | ||
257 | ssl.ContactGroupsC = v.(string) | 266 | ssl.ContactGroupsC = v.(string) |
258 | } | 267 | } |
259 | 268 | ||