Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit b84a223

Browse files
committed
fix aws default tags
1 parent 27e60eb commit b84a223

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

pkg/project/project.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ console.log("~j" + JSON.stringify(mod.app({
168168
continue
169169
}
170170

171-
err = p.Init(args)
171+
err = p.Init(proj.app.Name, proj.app.Stage, args)
172172
if err != nil {
173173
return nil, err
174174
}

pkg/project/provider/aws.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package provider
33
import (
44
"bytes"
55
"context"
6+
"encoding/json"
67
"errors"
78
"fmt"
89
"io"
@@ -143,7 +144,7 @@ func (a *AwsProvider) Cancel(app string, stage string) error {
143144
return nil
144145
}
145146

146-
func (a *AwsProvider) Init(args map[string]string) (err error) {
147+
func (a *AwsProvider) Init(app string, stage string, args map[string]string) (err error) {
147148
a.args = args
148149

149150
cfg, err := a.resolveConfig()
@@ -180,6 +181,17 @@ func (a *AwsProvider) Init(args map[string]string) (err error) {
180181
args["region"] = cfg.Region
181182
}
182183

184+
tags, err := json.Marshal(map[string]interface{}{
185+
"tags": map[string]string{
186+
"sst:app": app,
187+
"sst:stage": stage,
188+
},
189+
})
190+
if err != nil {
191+
return err
192+
}
193+
args["defaultTags"] = string(tags)
194+
183195
return err
184196
}
185197

pkg/project/provider/cloudflare.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package provider
33
type CloudflareProvider struct {
44
}
55

6-
func (c *CloudflareProvider) Init(args map[string]string) error {
6+
func (c *CloudflareProvider) Init(app string, stage string, args map[string]string) error {
77
return nil
88
}

pkg/project/provider/provider.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
)
1515

1616
type Backend interface {
17-
Init(provider map[string]string) error
1817
Lock(app string, stage string, out *os.File) error
1918
Unlock(app string, stage string, in *os.File) error
2019
Cancel(app string, stage string) error
@@ -28,7 +27,7 @@ type Backend interface {
2827
}
2928

3029
type Provider interface {
31-
Init(provider map[string]string) error
30+
Init(app string, stage string, provider map[string]string) error
3231
}
3332

3433
const SSM_NAME_BUCKET = "/sst/bootstrap"

0 commit comments

Comments
 (0)