Skip to content

Commit

Permalink
Add labels support when adding fields (#9333)
Browse files Browse the repository at this point in the history
  • Loading branch information
zli82016 authored Oct 24, 2023
1 parent 127027f commit f8ca423
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/content/develop/add-handwritten-datasource.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ a new datasource there are 5 steps to doing so.

1. Create a new datasource declaration file and a corresponding test file
1. Add Schema and Read operation implementation
- If there is `labels` field with type `KeyValueLabels` in the corresponding resource, in the datasource Read operation implementation, after the resource read method, call the function `tpgresource.SetDataSourceLabels(d)` to make `labels` and `terraform_labels` have all of the labels on the resource.
- If there is `annotations` field with type `KeyValueAnnotations` in the corresponding resource, in the datasource Read operation implementation, after the resource read method, call the function `tpgresource.SetDataSourceAnnotations(d)` to make `annotations` have all of the annotations on the resource.
1. Add the datasource to the `provider.go.erb` index
1. Implement a test which will create and resources and read the corresponding
datasource
Expand Down
2 changes: 2 additions & 0 deletions docs/content/develop/resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ For more information about types of resources and the generation process overall
```yaml
# Supported types: String, Integer, Boolean, Double, Enum,
# ResourceRef (link to a GCP resource), KeyValuePairs (string -> string map),
# KeyValueLabels (for standard resource 'labels' field),
# KeyValueAnnotations (for standard resource 'annotations' field)
# Array, and NestedObject
- !ruby/object:Api::Type::String
name: 'API_FIELD_NAME'
Expand Down

0 comments on commit f8ca423

Please sign in to comment.