Skip to content

Commit c565ba8

Browse files
committed
Add tags and account ids update
1 parent b97072c commit c565ba8

File tree

3 files changed

+322
-164
lines changed

3 files changed

+322
-164
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ This CLI will search for `document.yml` configurations files, recursively, in se
7373
name: MyDocument
7474
description: My document description
7575
accountIds:
76-
- 123456789
76+
- "123456789012"
7777
file: ./script.sh
7878
parameters:
7979
ParameterName:
@@ -100,6 +100,41 @@ tags:
100100
Environment: "${ENV}"
101101
```
102102

103+
### Account IDs explode values
104+
105+
If Account ID contains a comma the string will be exploded in simple string array. This is useful for account IDs reused with interpolation.
106+
107+
Fo example having environment variables (or .env file) set like this:
108+
```bash
109+
export ACCOUNT_IDS="123456789012,123456789013,123456789014"
110+
```
111+
and configuring document configuration like this:
112+
```yaml
113+
name: MyDocument
114+
file: ./script.sh
115+
accountIds:
116+
- "${ACCOUNT_IDS}"
117+
- "123456789015"
118+
```
119+
the deploy command will interpolate environment variables in:
120+
```yaml
121+
name: MyDocument
122+
file: ./script.sh
123+
accountIds:
124+
- "123456789012,123456789013,123456789014"
125+
- "123456789015"
126+
```
127+
and exploded in a string array:
128+
```yaml
129+
name: MyDocument
130+
file: ./script.sh
131+
accountIds:
132+
- "123456789012"
133+
- "123456789013"
134+
- "123456789014"
135+
- "123456789015"
136+
```
137+
103138
### Search path
104139

105140
Any command accept file or directory paths as arguments, any document configuration file that match will be loaded an added to list.

cmd/deploy/deploy.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,28 @@ func Action(c *cli.Context) error {
129129
func deploySingleDocument(ses *session.Session, region *string, accountID *string, document *document.Document) error {
130130
var err error
131131

132+
isAlreadyDeployed := document.IsDeployed()
133+
132134
// Deploy document
133-
fmt.Println(fmt.Sprintf("[%s] Deploying..", document.Name))
135+
if !isAlreadyDeployed {
136+
fmt.Println(fmt.Sprintf("[%s] Creating..", document.Name))
137+
} else {
138+
fmt.Println(fmt.Sprintf("[%s] Updating..", document.Name))
139+
}
134140
err = document.Deploy()
135141
if err != nil {
136142
return err
137143
}
138144

145+
// Update tags
146+
if isAlreadyDeployed {
147+
fmt.Println(fmt.Sprintf("[%s] Updating tags..", document.Name))
148+
err = document.UpdateTags()
149+
if err != nil {
150+
return err
151+
}
152+
}
153+
139154
fmt.Println(fmt.Sprintf("[%s] Deploy completed!", document.Name))
140155
return nil
141156
}

0 commit comments

Comments
 (0)