aboutsummaryrefslogtreecommitdiffhomepage
path: root/resource_statuscaketest.go
diff options
context:
space:
mode:
authorPaul Stack <public@paulstack.co.uk>2017-02-15 23:29:05 +0000
committerGitHub <noreply@github.com>2017-02-15 23:29:05 +0000
commit90db3fb0ba1aff53f83ece8f5d62f56943ed090e (patch)
tree0a0eb730ee6a18d683d658d463e3f07b9107d1a4 /resource_statuscaketest.go
parent6ad7af97bbcfa90a6798dd78ae19adfcef179bdc (diff)
downloadterraform-provider-statuscake-90db3fb0ba1aff53f83ece8f5d62f56943ed090e.tar.gz
terraform-provider-statuscake-90db3fb0ba1aff53f83ece8f5d62f56943ed090e.tar.zst
terraform-provider-statuscake-90db3fb0ba1aff53f83ece8f5d62f56943ed090e.zip
provider/statuscake: Add support for Port in statuscake_test (#11966)
Fixes: #11923 This required the upstream library to have a PR accepted
Diffstat (limited to 'resource_statuscaketest.go')
-rw-r--r--resource_statuscaketest.go28
1 files changed, 19 insertions, 9 deletions
diff --git a/resource_statuscaketest.go b/resource_statuscaketest.go
index bc05364..dbc15c9 100644
--- a/resource_statuscaketest.go
+++ b/resource_statuscaketest.go
@@ -18,50 +18,55 @@ func resourceStatusCakeTest() *schema.Resource {
18 Read: ReadTest, 18 Read: ReadTest,
19 19
20 Schema: map[string]*schema.Schema{ 20 Schema: map[string]*schema.Schema{
21 "test_id": &schema.Schema{ 21 "test_id": {
22 Type: schema.TypeString, 22 Type: schema.TypeString,
23 Computed: true, 23 Computed: true,
24 }, 24 },
25 25
26 "website_name": &schema.Schema{ 26 "website_name": {
27 Type: schema.TypeString, 27 Type: schema.TypeString,
28 Required: true, 28 Required: true,
29 }, 29 },
30 30
31 "website_url": &schema.Schema{ 31 "website_url": {
32 Type: schema.TypeString, 32 Type: schema.TypeString,
33 Required: true, 33 Required: true,
34 }, 34 },
35 35
36 "contact_id": &schema.Schema{ 36 "contact_id": {
37 Type: schema.TypeInt, 37 Type: schema.TypeInt,
38 Optional: true, 38 Optional: true,
39 }, 39 },
40 40
41 "check_rate": &schema.Schema{ 41 "check_rate": {
42 Type: schema.TypeInt, 42 Type: schema.TypeInt,
43 Optional: true, 43 Optional: true,
44 Default: 300, 44 Default: 300,
45 }, 45 },
46 46
47 "test_type": &schema.Schema{ 47 "test_type": {
48 Type: schema.TypeString, 48 Type: schema.TypeString,
49 Required: true, 49 Required: true,
50 }, 50 },
51 51
52 "paused": &schema.Schema{ 52 "paused": {
53 Type: schema.TypeBool, 53 Type: schema.TypeBool,
54 Optional: true, 54 Optional: true,
55 Default: false, 55 Default: false,
56 }, 56 },
57 57
58 "timeout": &schema.Schema{ 58 "timeout": {
59 Type: schema.TypeInt, 59 Type: schema.TypeInt,
60 Optional: true, 60 Optional: true,
61 Default: 40, 61 Default: 40,
62 }, 62 },
63 63
64 "confirmations": &schema.Schema{ 64 "confirmations": {
65 Type: schema.TypeInt,
66 Optional: true,
67 },
68
69 "port": {
65 Type: schema.TypeInt, 70 Type: schema.TypeInt,
66 Optional: true, 71 Optional: true,
67 }, 72 },
@@ -81,6 +86,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
81 Timeout: d.Get("timeout").(int), 86 Timeout: d.Get("timeout").(int),
82 ContactID: d.Get("contact_id").(int), 87 ContactID: d.Get("contact_id").(int),
83 Confirmation: d.Get("confirmations").(int), 88 Confirmation: d.Get("confirmations").(int),
89 Port: d.Get("port").(int),
84 } 90 }
85 91
86 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string)) 92 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string))
@@ -144,6 +150,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
144 d.Set("timeout", testResp.Timeout) 150 d.Set("timeout", testResp.Timeout)
145 d.Set("contact_id", testResp.ContactID) 151 d.Set("contact_id", testResp.ContactID)
146 d.Set("confirmations", testResp.Confirmation) 152 d.Set("confirmations", testResp.Confirmation)
153 d.Set("port", testResp.Port)
147 154
148 return nil 155 return nil
149} 156}
@@ -183,5 +190,8 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
183 if v, ok := d.GetOk("confirmations"); ok { 190 if v, ok := d.GetOk("confirmations"); ok {
184 test.Confirmation = v.(int) 191 test.Confirmation = v.(int)
185 } 192 }
193 if v, ok := d.GetOk("port"); ok {
194 test.Port = v.(int)
195 }
186 return test 196 return test
187} 197}