File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,10 @@ func (d *Document) Deploy() error {
263263 }
264264
265265 // Create document
266- _ , err = d .clients .ssm .CreateDocument (input )
266+ _ , err := d .clients .ssm .CreateDocument (input )
267+ if err != nil {
268+ return err
269+ }
267270 } else {
268271 input := & ssm.UpdateDocumentInput {
269272 Name : & d .Name ,
@@ -273,7 +276,23 @@ func (d *Document) Deploy() error {
273276 }
274277
275278 // Update document
276- _ , err = d .clients .ssm .UpdateDocument (input )
279+ res , err := d .clients .ssm .UpdateDocument (input )
280+ if err != nil {
281+ if awsErr , ok := err .(awserr.Error ); ok {
282+ if awsErr .Code () != ssm .ErrCodeDuplicateDocumentContent {
283+ return err
284+ }
285+ }
286+ } else {
287+ // Update latest document version
288+ _ , err = d .clients .ssm .UpdateDocumentDefaultVersion (& ssm.UpdateDocumentDefaultVersionInput {
289+ Name : & d .Name ,
290+ DocumentVersion : res .DocumentDescription .DocumentVersion ,
291+ })
292+ if err != nil {
293+ return err
294+ }
295+ }
277296 }
278297
279298 // Check for deploy error
You can’t perform that action at this time.
0 commit comments