@@ -10,7 +10,7 @@ import (
10
10
)
11
11
12
12
func TestAccScalewaySecurityGroupRule_Basic (t * testing.T ) {
13
- var group api.SecurityGroups
13
+ var group api.SecurityGroup
14
14
15
15
resource .Test (t , resource.TestCase {
16
16
PreCheck : func () { testAccPreCheck (t ) },
@@ -40,7 +40,7 @@ func TestAccScalewaySecurityGroupRule_Basic(t *testing.T) {
40
40
}
41
41
42
42
func TestAccScalewaySecurityGroupRule_Count (t * testing.T ) {
43
- var group api.SecurityGroups
43
+ var group api.SecurityGroup
44
44
45
45
resource .Test (t , resource.TestCase {
46
46
PreCheck : func () { testAccPreCheck (t ) },
@@ -59,7 +59,7 @@ func TestAccScalewaySecurityGroupRule_Count(t *testing.T) {
59
59
})
60
60
}
61
61
62
- func testAccCheckScalewaySecurityGroupsExists (n string , group * api.SecurityGroups ) resource.TestCheckFunc {
62
+ func testAccCheckScalewaySecurityGroupsExists (n string , group * api.SecurityGroup ) resource.TestCheckFunc {
63
63
return func (s * terraform.State ) error {
64
64
rs , ok := s .RootModule ().Resources [n ]
65
65
if ! ok {
@@ -71,14 +71,14 @@ func testAccCheckScalewaySecurityGroupsExists(n string, group *api.SecurityGroup
71
71
}
72
72
73
73
conn := testAccProvider .Meta ().(* Client ).scaleway
74
- resp , err := conn .GetASecurityGroup (rs .Primary .ID )
74
+ resp , err := conn .GetSecurityGroup (rs .Primary .ID )
75
75
76
76
if err != nil {
77
77
return err
78
78
}
79
79
80
- if resp .SecurityGroups . ID == rs .Primary .ID {
81
- * group = resp . SecurityGroups
80
+ if resp .ID == rs .Primary .ID {
81
+ * group = * resp
82
82
return nil
83
83
}
84
84
@@ -100,8 +100,8 @@ func testAccCheckScalewaySecurityGroupRuleDestroy(s *terraform.State) error {
100
100
}
101
101
102
102
all_err := true
103
- for _ , group := range groups . SecurityGroups {
104
- _ , err := client .GetASecurityGroupRule (group .ID , rs .Primary .ID )
103
+ for _ , group := range groups {
104
+ _ , err := client .GetSecurityGroupRule (group .ID , rs .Primary .ID )
105
105
all_err = all_err && err != nil
106
106
}
107
107
@@ -113,40 +113,40 @@ func testAccCheckScalewaySecurityGroupRuleDestroy(s *terraform.State) error {
113
113
return nil
114
114
}
115
115
116
- func testAccCheckScalewaySecurityGroupRuleAttributes (n string , group * api.SecurityGroups ) resource.TestCheckFunc {
116
+ func testAccCheckScalewaySecurityGroupRuleAttributes (n string , group * api.SecurityGroup ) resource.TestCheckFunc {
117
117
return func (s * terraform.State ) error {
118
118
rs , ok := s .RootModule ().Resources [n ]
119
119
if ! ok {
120
120
return fmt .Errorf ("Unknown resource: %s" , n )
121
121
}
122
122
123
123
client := testAccProvider .Meta ().(* Client ).scaleway
124
- rule , err := client .GetASecurityGroupRule (group .ID , rs .Primary .ID )
124
+ rule , err := client .GetSecurityGroupRule (group .ID , rs .Primary .ID )
125
125
if err != nil {
126
126
return err
127
127
}
128
128
129
- if rule .Rules . Action != "accept" {
129
+ if rule .Action != "accept" {
130
130
return fmt .Errorf ("Wrong rule action" )
131
131
}
132
- if rule .Rules . Direction != "inbound" {
132
+ if rule .Direction != "inbound" {
133
133
return fmt .Errorf ("wrong rule direction" )
134
134
}
135
- if rule .Rules . IPRange != "0.0.0.0/0" {
135
+ if rule .IPRange != "0.0.0.0/0" {
136
136
return fmt .Errorf ("wrong rule IP Range" )
137
137
}
138
- if rule .Rules . Protocol != "TCP" {
138
+ if rule .Protocol != "TCP" {
139
139
return fmt .Errorf ("wrong rule protocol" )
140
140
}
141
- if rule .Rules . DestPortFrom != 80 {
141
+ if rule .DestPortFrom != 80 {
142
142
return fmt .Errorf ("Wrong port" )
143
143
}
144
144
145
145
return nil
146
146
}
147
147
}
148
148
149
- func testAccCheckScalewaySecurityGroupRuleExists (n string , group * api.SecurityGroups ) resource.TestCheckFunc {
149
+ func testAccCheckScalewaySecurityGroupRuleExists (n string , group * api.SecurityGroup ) resource.TestCheckFunc {
150
150
return func (s * terraform.State ) error {
151
151
rs , ok := s .RootModule ().Resources [n ]
152
152
@@ -159,13 +159,13 @@ func testAccCheckScalewaySecurityGroupRuleExists(n string, group *api.SecurityGr
159
159
}
160
160
161
161
client := testAccProvider .Meta ().(* Client ).scaleway
162
- rule , err := client .GetASecurityGroupRule (group .ID , rs .Primary .ID )
162
+ rule , err := client .GetSecurityGroupRule (group .ID , rs .Primary .ID )
163
163
164
164
if err != nil {
165
165
return err
166
166
}
167
167
168
- if rule .Rules . ID != rs .Primary .ID {
168
+ if rule .ID != rs .Primary .ID {
169
169
return fmt .Errorf ("Record not found" )
170
170
}
171
171
0 commit comments