Skip to content

Commit

Permalink
Fixed the issue that the update function isn't triggered when the con…
Browse files Browse the repository at this point in the history
…tent of the sealed secrets has been updated
  • Loading branch information
rockyhmchen committed Feb 7, 2020
1 parent af5462e commit efa1aa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GO_GET=$(GO_CMD) get
all: clean build

build:
$(GO_BUILD) -o $(BINARY_NAME)_${VERSION} -v
$(GO_BUILD) -o $(BINARY_NAME)_v${VERSION} -v

test:
$(GO_GET) gotest.tools/gotestsum
Expand Down
11 changes: 6 additions & 5 deletions sealedsecrets/resource_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func resourceSecretCreate(d *schema.ResourceData, m interface{}) error {
return err
}

// d.SetId(utils.SHA256(ss.ModTime().Format(time.RFC3339)))
d.SetId(utils.SHA256(utils.GetFileContent(ssPath)))

return resourceSecretRead(d, m)
Expand Down Expand Up @@ -112,9 +111,12 @@ func resourceSecretRead(d *schema.ResourceData, m interface{}) error {
return nil
}

// ss, _ := os.Stat(ssPath)
// d.SetId(utils.SHA256(ss.ModTime().Format(time.RFC3339)))
d.SetId(utils.SHA256(utils.GetFileContent(ssPath)))
oldID := d.Id()
newID := utils.SHA256(utils.GetFileContent(ssPath))
if oldID != newID {
d.SetId("")
return nil
}

return nil
}
Expand Down Expand Up @@ -155,7 +157,6 @@ func createSealedSecret(d *schema.ResourceData, mainCmd *Cmd) error {
utils.Log(errMsg)
return errors.New(errMsg)
}
// s, _ := os.Stat(sPath)

cert := d.Get("certificate").(string)
if !utils.PathExists(cert) {
Expand Down

0 comments on commit efa1aa1

Please sign in to comment.