Skip to content

Commit 5f0b766

Browse files
authored
Merge pull request #78 from snidell/fixOptional
Make routable and outbound_traffic truly optional
2 parents e81602b + fbee899 commit 5f0b766

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

skytap/resource_skytap_environment.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func resourceSkytapEnvironment() *schema.Resource {
5454
"outbound_traffic": {
5555
Type: schema.TypeBool,
5656
Optional: true,
57-
Default: false,
5857
Description: "Indicates whether networks in the environment can send outbound traffic",
5958
},
6059

@@ -103,7 +102,6 @@ func resourceSkytapEnvironment() *schema.Resource {
103102
"routable": {
104103
Type: schema.TypeBool,
105104
Optional: true,
106-
Default: false,
107105
Description: "Indicates whether networks within the environment can route traffic to one another",
108106
},
109107

@@ -143,14 +141,18 @@ func resourceSkytapEnvironmentCreate(ctx context.Context, d *schema.ResourceData
143141

144142
templateID := d.Get("template_id").(string)
145143
name := d.Get("name").(string)
146-
outboundTraffic := d.Get("outbound_traffic").(bool)
147-
routable := d.Get("routable").(bool)
148144

149145
opts := skytap.CreateEnvironmentRequest{
150-
TemplateID: &templateID,
151-
Name: &name,
152-
OutboundTraffic: &outboundTraffic,
153-
Routable: &routable,
146+
TemplateID: &templateID,
147+
Name: &name,
148+
}
149+
150+
if v, ok := d.GetOk("outbound_traffic"); ok {
151+
opts.OutboundTraffic = utils.Bool(v.(bool))
152+
}
153+
154+
if v, ok := d.GetOk("routable"); ok {
155+
opts.OutboundTraffic = utils.Bool(v.(bool))
154156
}
155157

156158
if v, ok := d.GetOk("description"); ok {

0 commit comments

Comments
 (0)