Skip to content

Commit 49e1588

Browse files
Add "Sensitive: true" for securing sensitive data in state (#325)
* Add sensitive=true for alert configuration tokens and keys * Format alert_configurations
1 parent ef15073 commit 49e1588

File tree

2 files changed

+42
-28
lines changed

2 files changed

+42
-28
lines changed

mongodbatlas/data_source_mongodbatlas_alert_configuration.go

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,18 @@ func dataSourceMongoDBAtlasAlertConfiguration() *schema.Resource {
113113
Elem: &schema.Resource{
114114
Schema: map[string]*schema.Schema{
115115
"api_token": {
116-
Type: schema.TypeString,
117-
Computed: true,
116+
Type: schema.TypeString,
117+
Sensitive: true,
118+
Computed: true,
118119
},
119120
"channel_name": {
120121
Type: schema.TypeString,
121122
Computed: true,
122123
},
123124
"datadog_api_key": {
124-
Type: schema.TypeString,
125-
Computed: true,
125+
Type: schema.TypeString,
126+
Sensitive: true,
127+
Computed: true,
126128
},
127129
"datadog_region": {
128130
Type: schema.TypeString,
@@ -141,8 +143,9 @@ func dataSourceMongoDBAtlasAlertConfiguration() *schema.Resource {
141143
Computed: true,
142144
},
143145
"flowdock_api_token": {
144-
Type: schema.TypeString,
145-
Computed: true,
146+
Type: schema.TypeString,
147+
Sensitive: true,
148+
Computed: true,
146149
},
147150
"flow_name": {
148151
Type: schema.TypeString,
@@ -157,8 +160,9 @@ func dataSourceMongoDBAtlasAlertConfiguration() *schema.Resource {
157160
Computed: true,
158161
},
159162
"ops_genie_api_key": {
160-
Type: schema.TypeString,
161-
Computed: true,
163+
Type: schema.TypeString,
164+
Sensitive: true,
165+
Computed: true,
162166
},
163167
"ops_genie_region": {
164168
Type: schema.TypeString,
@@ -169,8 +173,9 @@ func dataSourceMongoDBAtlasAlertConfiguration() *schema.Resource {
169173
Computed: true,
170174
},
171175
"service_key": {
172-
Type: schema.TypeString,
173-
Computed: true,
176+
Type: schema.TypeString,
177+
Sensitive: true,
178+
Computed: true,
174179
},
175180
"sms_enabled": {
176181
Type: schema.TypeBool,
@@ -189,12 +194,14 @@ func dataSourceMongoDBAtlasAlertConfiguration() *schema.Resource {
189194
Computed: true,
190195
},
191196
"victor_ops_api_key": {
192-
Type: schema.TypeString,
193-
Computed: true,
197+
Type: schema.TypeString,
198+
Sensitive: true,
199+
Computed: true,
194200
},
195201
"victor_ops_routing_key": {
196-
Type: schema.TypeString,
197-
Computed: true,
202+
Type: schema.TypeString,
203+
Sensitive: true,
204+
Computed: true,
198205
},
199206
"roles": {
200207
Type: schema.TypeList,

mongodbatlas/resource_mongodbatlas_alert_configuration.go

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,18 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource {
168168
Elem: &schema.Resource{
169169
Schema: map[string]*schema.Schema{
170170
"api_token": {
171-
Type: schema.TypeString,
172-
Optional: true,
171+
Type: schema.TypeString,
172+
Sensitive: true,
173+
Optional: true,
173174
},
174175
"channel_name": {
175176
Type: schema.TypeString,
176177
Optional: true,
177178
},
178179
"datadog_api_key": {
179-
Type: schema.TypeString,
180-
Optional: true,
180+
Type: schema.TypeString,
181+
Sensitive: true,
182+
Optional: true,
181183
},
182184
"datadog_region": {
183185
Type: schema.TypeString,
@@ -197,8 +199,9 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource {
197199
Optional: true,
198200
},
199201
"flowdock_api_token": {
200-
Type: schema.TypeString,
201-
Optional: true,
202+
Type: schema.TypeString,
203+
Sensitive: true,
204+
Optional: true,
202205
},
203206
"flow_name": {
204207
Type: schema.TypeString,
@@ -213,8 +216,9 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource {
213216
Optional: true,
214217
},
215218
"ops_genie_api_key": {
216-
Type: schema.TypeString,
217-
Optional: true,
219+
Type: schema.TypeString,
220+
Sensitive: true,
221+
Optional: true,
218222
},
219223
"ops_genie_region": {
220224
Type: schema.TypeString,
@@ -226,8 +230,9 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource {
226230
Optional: true,
227231
},
228232
"service_key": {
229-
Type: schema.TypeString,
230-
Optional: true,
233+
Type: schema.TypeString,
234+
Sensitive: true,
235+
Optional: true,
231236
},
232237
"sms_enabled": {
233238
Type: schema.TypeBool,
@@ -246,12 +251,14 @@ func resourceMongoDBAtlasAlertConfiguration() *schema.Resource {
246251
Optional: true,
247252
},
248253
"victor_ops_api_key": {
249-
Type: schema.TypeString,
250-
Optional: true,
254+
Type: schema.TypeString,
255+
Sensitive: true,
256+
Optional: true,
251257
},
252258
"victor_ops_routing_key": {
253-
Type: schema.TypeString,
254-
Optional: true,
259+
Type: schema.TypeString,
260+
Sensitive: true,
261+
Optional: true,
255262
},
256263
"roles": {
257264
Type: schema.TypeList,

0 commit comments

Comments
 (0)