Skip to content

Commit c58392b

Browse files
diff-processor: add doc detector for ephemeral attributes (#15075)
1 parent e3f9ae6 commit c58392b

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

tools/diff-processor/documentparser/document_parser.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,19 @@ func traverse(paths *[]string, path string, n *node) {
6666
// Parse parse a resource document markdown's arguments and attributes section.
6767
// The parsed file format is defined in mmv1/templates/terraform/resource.html.markdown.tmpl.
6868
func (d *DocumentParser) Parse(src []byte) error {
69-
var argument, attribute string
69+
var argument, attribute, ephemeralAttribute string
7070
for _, p := range strings.Split(string(src), "\n"+sectionSeparator) {
7171
if strings.HasPrefix(p, "Attributes Reference") {
7272
attribute = p
7373
}
7474
if strings.HasPrefix(p, "Argument Reference") {
7575
argument = p
7676
}
77+
if strings.HasPrefix(p, "Ephemeral Attributes Reference") {
78+
ephemeralAttribute = p
79+
}
7780
}
78-
for _, text := range []string{argument, attribute} {
81+
for _, text := range []string{argument, attribute, ephemeralAttribute} {
7982
if len(text) != 0 {
8083
sections := horizontalLineRegex.Split(text, -1)
8184
var allTopLevelFieldSections string

tools/diff-processor/documentparser/document_parser_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ func TestParse(t *testing.T) {
7878
"workload_identity_config.issuer_uri",
7979
"workload_identity_config.workload_pool",
8080
"errors.message",
81+
// The below are from the ephemeral attributes section.
82+
"shared_secret_wo",
83+
"sensitive_params",
84+
"sensitive_params.secret_access_key_wo",
8185
}
8286
got := parser.FlattenFields()
8387
// gotAttributes := parser.Attributes()

tools/diff-processor/testdata/resource.html.markdown

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,34 @@ exported:
275275
(Optional)
276276
Human-friendly description of the error.
277277

278+
## Ephemeral Attributes Reference
279+
280+
The following write-only attributes are supported:
281+
282+
* `shared_secret_wo` -
283+
(Optional)
284+
Shared secret used to set the secure session between the Cloud VPN
285+
gateway and the peer VPN gateway.
286+
Note: This property is write-only and will not be read from the API. For more info see [updating write-only attributes](/docs/providers/google/guides/using_write_only_attributes.html#updating-write-only-attributes)
287+
**Note**: This property is write-only and will not be read from the API.
288+
289+
* `sensitive_params` -
290+
(Optional)
291+
Different parameters are configured primarily using the the `params` field on this
292+
resource. This block contains the parameters which contain secrets or passwords so that they can be marked
293+
sensitive and hidden from plan output. The name of the field, eg: secret_access_key, will be the key
294+
in the `params` map in the api request.
295+
Credentials may not be specified in both locations and will cause an error. Changing from one location
296+
to a different credential configuration in the config will require an apply to update state.
297+
Structure is [documented below](#nested_sensitive_params).
298+
299+
<a name="nested_sensitive_params"></a>The `sensitive_params` block supports:
300+
301+
* `secret_access_key_wo` -
302+
(Optional)
303+
The Secret Access Key of the AWS account transferring data from.
304+
**Note**: This property is write-only and will not be read from the API.
305+
278306
## Timeouts
279307

280308
Lorem ipsum

0 commit comments

Comments
 (0)