Skip to content

Commit

Permalink
SCALRCORE-18527 > Fix go.mod and go.sum
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Vang committed Apr 9, 2021
1 parent a90decc commit 9e27b8d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/hashicorp/terraform v0.12.0
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/scalr/go-scalr v0.0.0-20210210153908-cc4b896f1392
github.com/scalr/go-scalr v0.0.0-20210409150119-91a63924ba82
)

go 1.13
12 changes: 2 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,8 @@ github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNue
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/scalr/go-scalr v0.0.0-20201202105129-922fc963a53b h1:JIXSPuMw2wdOeTnl9SgjZYlXtQCFpdKIjtErxpgUi+4=
github.com/scalr/go-scalr v0.0.0-20201202105129-922fc963a53b/go.mod h1:eEDwNsOdDKg5TJHljpJWfb4LhobfCkUHZo/uX/rPph8=
github.com/scalr/go-scalr v0.0.0-20210119110643-9039cc40492e h1:TkyqxRvCMLhEtRl2MOp6KwDtLun9XGh6aEqErJOFv8I=
github.com/scalr/go-scalr v0.0.0-20210119110643-9039cc40492e/go.mod h1:n2HQ6QxqyTySiSFTOpAL18SjCKtP+xUskMygO0KuuQU=
github.com/scalr/go-scalr v0.0.0-20210205141334-db4e3372ed61 h1:0uDGwtHyaSe3CMKK3VjkNvfmX9mM89G1P4f5ytTO6X8=
github.com/scalr/go-scalr v0.0.0-20210205141334-db4e3372ed61/go.mod h1:n2HQ6QxqyTySiSFTOpAL18SjCKtP+xUskMygO0KuuQU=
github.com/scalr/go-scalr v0.0.0-20210210152453-7bb6d92151c1 h1:gHAzXQxf45R84FzNk/EVL9yvMiALsQF/hy881+SRkUo=
github.com/scalr/go-scalr v0.0.0-20210210152453-7bb6d92151c1/go.mod h1:n2HQ6QxqyTySiSFTOpAL18SjCKtP+xUskMygO0KuuQU=
github.com/scalr/go-scalr v0.0.0-20210210153908-cc4b896f1392 h1:5omVbEGt+45vY40jFHAxR4s+ARr/csBQfGHtxSQ1HsI=
github.com/scalr/go-scalr v0.0.0-20210210153908-cc4b896f1392/go.mod h1:n2HQ6QxqyTySiSFTOpAL18SjCKtP+xUskMygO0KuuQU=
github.com/scalr/go-scalr v0.0.0-20210409150119-91a63924ba82 h1:+0Kh6Q4S9ZIGg87P3ARTOKXj04ODKEZnd+5czs9VHJE=
github.com/scalr/go-scalr v0.0.0-20210409150119-91a63924ba82/go.mod h1:n2HQ6QxqyTySiSFTOpAL18SjCKtP+xUskMygO0KuuQU=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
34 changes: 27 additions & 7 deletions scalr/resource_scalr_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ func resourceScalrWorkspace() *schema.Resource {

"path": {
Type: schema.TypeString,
Default: "",
Optional: true,
},

"trigger_prefixes": {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
},
},
Expand Down Expand Up @@ -160,10 +167,16 @@ func resourceScalrWorkspaceCreate(d *schema.ResourceData, meta interface{}) erro
// Get and assert the VCS repo configuration block.
if v, ok := d.GetOk("vcs_repo"); ok {
vcsRepo := v.([]interface{})[0].(map[string]interface{})
triggerPrefixes := []string{}

for _, pref := range vcsRepo["trigger_prefixes"].([]interface{}) {
triggerPrefixes = append(triggerPrefixes, pref.(string))
}

options.VCSRepo = &scalr.VCSRepoOptions{
Identifier: scalr.String(vcsRepo["identifier"].(string)),
Path: scalr.String(vcsRepo["path"].(string)),
Identifier: scalr.String(vcsRepo["identifier"].(string)),
Path: scalr.String(vcsRepo["path"].(string)),
TriggerPrefixes: &triggerPrefixes,
}

// Only set the branch if one is configured.
Expand Down Expand Up @@ -221,8 +234,9 @@ func resourceScalrWorkspaceRead(d *schema.ResourceData, meta interface{}) error
var vcsRepo []interface{}
if workspace.VCSRepo != nil {
vcsConfig := map[string]interface{}{
"identifier": workspace.VCSRepo.Identifier,
"path": workspace.VCSRepo.Path,
"identifier": workspace.VCSRepo.Identifier,
"path": workspace.VCSRepo.Path,
"trigger-prefixes": workspace.VCSRepo.TriggerPrefixes,
}

// Get and assert the VCS repo configuration block.
Expand Down Expand Up @@ -275,11 +289,17 @@ func resourceScalrWorkspaceUpdate(d *schema.ResourceData, meta interface{}) erro
// Get and assert the VCS repo configuration block.
if v, ok := d.GetOk("vcs_repo"); ok {
vcsRepo := v.([]interface{})[0].(map[string]interface{})
triggerPrefixes := make([]string, 0)

for _, pref := range vcsRepo["trigger_prefixes"].([]interface{}) {
triggerPrefixes = append(triggerPrefixes, pref.(string))
}

options.VCSRepo = &scalr.VCSRepoOptions{
Identifier: scalr.String(vcsRepo["identifier"].(string)),
Branch: scalr.String(vcsRepo["branch"].(string)),
Path: scalr.String(vcsRepo["path"].(string)),
Identifier: scalr.String(vcsRepo["identifier"].(string)),
Branch: scalr.String(vcsRepo["branch"].(string)),
Path: scalr.String(vcsRepo["path"].(string)),
TriggerPrefixes: &triggerPrefixes,
}
}

Expand Down

0 comments on commit 9e27b8d

Please sign in to comment.