Skip to content

Commit 4c5ef7e

Browse files
authored
Upgrade documentation hugo theme to v12, adjust layouts and features (#15253)
1 parent d54b0c0 commit 4c5ef7e

38 files changed

+280
-278
lines changed

.github/workflows/repository-documentation-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Hugo
2222
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2.6.0
2323
with:
24-
hugo-version: '0.136.5'
24+
hugo-version: '0.150.0'
2525
extended: true
2626

2727
- name: Build

.github/workflows/repository-documentation-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Hugo
2020
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2.6.0
2121
with:
22-
hugo-version: '0.136.5'
22+
hugo-version: '0.150.0'
2323
extended: true
2424

2525
- name: Build

docs/README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ To view locally:
66
[Go](https://go.dev/doc/install), and [Dart Sass](https://gohugo.io/hugo-pipes/transpile-sass-to-css/#dart-sass).
77
You require these prerequisites for installing Hugo.
88

9-
1. Install Hugo v0.136.5:
9+
1. Install Hugo v0.150.0:
1010
```bash
11-
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.136.5
11+
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.150.0
1212
```
1313

1414
1. Restart your terminal.
@@ -38,10 +38,17 @@ If you are having deployment issues, try to reset your hugo module cache.
3838
* `hugo mod clean`
3939

4040
To upgrade the theme version:
41-
1. find the version you want at https://github.com/alex-shpak/hugo-book/commits/master
41+
1. Find the version you want at https://github.com/alex-shpak/hugo-book/releases
4242
2. Run the following
43-
```bash
44-
go get github.com/alex-shpak/hugo-book@{{commit_hash}}
45-
## example
46-
## go get github.com/alex-shpak/hugo-book@d86d5e70c7c0d787675b13d9aee749c1a8b34776
47-
```
43+
```bash
44+
hugo mod get github.com/alex-shpak/hugo-book/${module_version}
45+
```
46+
Example:
47+
```
48+
hugo mod get github.com/alex-shpak/hugo-book/v12
49+
```
50+
Or to get specific commit tagged with v12.0.0
51+
```bash
52+
hugo mod get github.com/alex-shpak/hugo-book/[email protected]
53+
```
54+

docs/assets/icons/report.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
22
title: "Best practices"
33
weight: 60
4+
params:
5+
bookCollapseSection: true
46
---

docs/content/best-practices/deletion-behaviors.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ weight: 20
55

66
# Deletion behaviors
77

8-
{{< hint info >}}
9-
**Note:** This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.
10-
{{< /hint >}}
8+
> [!NOTE]
9+
> **Note:** This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.
1110
1211
## Mitigating data loss risk via deletion_protection {#deletion_protection}
1312

@@ -26,9 +25,8 @@ Resources that do not have a significant risk of unrecoverable data loss or simi
2625

2726
See [Client-side fields]({{< ref "/develop/client-side-fields" >}}) for information about adding `deletion_protection` fields.
2827

29-
{{< hint info >}}
30-
**Note:** The previous best practice was a field called `force_delete` that defaulted to `false`. This is still present on some resources for backwards-compatibility reasons, but `deletion_protection` is preferred going forward.
31-
{{< /hint >}}
28+
> [!NOTE]
29+
> **Note:** The previous best practice was a field called `force_delete` that defaulted to `false`. This is still present on some resources for backwards-compatibility reasons, but `deletion_protection` is preferred going forward.
3230
3331
## Deletion policy {#deletion_policy}
3432

docs/content/best-practices/immutable-fields.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ aliases:
88

99
# Immutable fields
1010

11-
{{< hint info >}}
12-
**Note:** This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.
13-
{{< /hint >}}
11+
> [!NOTE]
12+
> **Note:** This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.
1413
1514
[`ForceNew`](https://developer.hashicorp.com/terraform/intro#how-does-terraform-work) in a Terraform resource schema attribute that indicates that a field is immutable – that is, that a change to the field requires the resource to be destroyed and recreated.
1615

docs/content/best-practices/labels-and-annotations.md

Lines changed: 85 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ weight: 30
55

66
# Add labels and annotations support
77

8-
{{< hint info >}}
9-
**Note:** This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.
10-
{{< /hint >}}
8+
> [!NOTE]
9+
> **Note:** This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.
1110
1211
The new labels model and the new annotations model are introduced in [Terraform provider for Google Cloud 5.0.0](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/version_5_upgrade#provider).
1312

@@ -29,83 +28,83 @@ When adding a new `labels` field, please make the changes below to support the n
2928

3029
1. Use the type `KeyValueLabels` for the standard resource `labels` field. The standard resource `labels` field could be the top level `labels` field or the nested `labels` field inside the top level `metadata` field. Don't add `default_from_api: true` to this field or don't use this type for other `labels` fields in the resource. `KeyValueLabels` will add all of changes required for the new model automatically.
3130

32-
```yaml
33-
- name: 'labels'
34-
type: KeyValueLabels
35-
description: |
36-
The labels associated with this dataset. You can use these to
37-
organize and group your datasets.
38-
```
31+
```yaml
32+
- name: 'labels'
33+
type: KeyValueLabels
34+
description: |
35+
The labels associated with this dataset. You can use these to
36+
organize and group your datasets.
37+
```
3938
2. In the handwritten acceptance tests, add `labels` and `terraform_labels` to `ImportStateVerifyIgnore` if `labels` field is in the configuration.
4039

41-
```go
42-
ImportStateVerifyIgnore: []string{"labels", "terraform_labels"},
43-
```
40+
```go
41+
ImportStateVerifyIgnore: []string{"labels", "terraform_labels"},
42+
```
4443
3. In the corresponding data source, 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.
4544

46-
```go
47-
err = resourceArtifactRegistryRepositoryRead(d, meta)
48-
if err != nil {
49-
return err
50-
}
45+
```go
46+
err = resourceArtifactRegistryRepositoryRead(d, meta)
47+
if err != nil {
48+
return err
49+
}
5150

52-
if err := tpgresource.SetDataSourceLabels(d); err != nil {
53-
return err
54-
}
55-
```
51+
if err := tpgresource.SetDataSourceLabels(d); err != nil {
52+
return err
53+
}
54+
```
5655

5756
### Handwritten resources
5857

5958
1. Add `tpgresource.SetLabelsDiff` to `CustomizeDiff` of the resource.
60-
```go
61-
CustomizeDiff: customdiff.All(
62-
tpgresource.SetLabelsDiff,
63-
),
64-
```
59+
```go
60+
CustomizeDiff: customdiff.All(
61+
tpgresource.SetLabelsDiff,
62+
),
63+
```
6564
2. Add `labels` field and add more attributes (such as `ForceNew: true,`, `Set: schema.HashString,`) to this field if necessary.
66-
```go
67-
"labels": {
68-
Type: schema.TypeMap,
69-
Optional: true,
70-
Elem: &schema.Schema{Type: schema.TypeString},
71-
Description: `A set of key/value label pairs to assign to the project.
72-
73-
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
74-
Please refer to the field 'effective_labels' for all of the labels present on the resource.`,
75-
},
76-
```
65+
```go
66+
"labels": {
67+
Type: schema.TypeMap,
68+
Optional: true,
69+
Elem: &schema.Schema{Type: schema.TypeString},
70+
Description: `A set of key/value label pairs to assign to the project.
71+
72+
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
73+
Please refer to the field 'effective_labels' for all of the labels present on the resource.`,
74+
},
75+
```
7776
3. Add output only field `terraform_labels` and add more attributes (such as `Set: schema.HashString,`) to this field if necessary. Don't add `ForceNew:true,` to this field.
78-
```go
79-
"terraform_labels": {
80-
Type: schema.TypeMap,
81-
Computed: true,
82-
Description: `The combination of labels configured directly on the resource and default labels configured on the provider.`,
83-
Elem: &schema.Schema{Type: schema.TypeString},
84-
},
85-
```
77+
```go
78+
"terraform_labels": {
79+
Type: schema.TypeMap,
80+
Computed: true,
81+
Description: `The combination of labels configured directly on the resource and default labels configured on the provider.`,
82+
Elem: &schema.Schema{Type: schema.TypeString},
83+
},
84+
```
8685
4. Add output only field `effective_labels` and add more attributes (such as `ForceNew: true,`, `Set: schema.HashString,`) to this field if necessary.
87-
```go
88-
"effective_labels": {
89-
Type: schema.TypeMap,
90-
Computed: true,
91-
Description: `All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.`,
92-
Elem: &schema.Schema{Type: schema.TypeString},
93-
},
94-
```
86+
```go
87+
"effective_labels": {
88+
Type: schema.TypeMap,
89+
Computed: true,
90+
Description: `All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.`,
91+
Elem: &schema.Schema{Type: schema.TypeString},
92+
},
93+
```
9594
5. In the create method, use the value of `effective_labels` in API request.
9695
6. In the update method, use the value of `effective_labels` in API request.
9796
7. In the read mehtod, set `labels`, `terraform_labels` and `effective_labels` to state.
98-
```go
99-
if err := tpgresource.SetLabels(res.Labels, d, "labels"); err != nil {
100-
return fmt.Errorf("Error setting labels: %s", err)
101-
}
102-
if err := tpgresource.SetLabels(res.Labels, d, "terraform_labels"); err != nil {
103-
return fmt.Errorf("Error setting terraform_labels: %s", err)
104-
}
105-
if err := d.Set("effective_labels", res.Labels); err != nil {
106-
return fmt.Errorf("Error setting effective_labels: %s", err)
107-
}
108-
```
97+
```go
98+
if err := tpgresource.SetLabels(res.Labels, d, "labels"); err != nil {
99+
return fmt.Errorf("Error setting labels: %s", err)
100+
}
101+
if err := tpgresource.SetLabels(res.Labels, d, "terraform_labels"); err != nil {
102+
return fmt.Errorf("Error setting terraform_labels: %s", err)
103+
}
104+
if err := d.Set("effective_labels", res.Labels); err != nil {
105+
return fmt.Errorf("Error setting effective_labels: %s", err)
106+
}
107+
```
109108
8. In the handwritten acceptance tests, add `labels` and `terraform_labels` to `ImportStateVerifyIgnore`.
110109
9. In the corresponding data source, 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.
111110
10. Add the documentation for these label-related fields.
@@ -117,33 +116,33 @@ When adding a new `annotations` field, please make the changes below below to su
117116

118117
1. Use the type `KeyValueAnnotations` for the standard resource `annotations` field. The standard resource `annotations` field could be the top level `annotations` field or the nested `annotations` field inside the top level `metadata` field. Don't add `default_from_api: true` to this field or don't use this type for other `annotations` fields in the resource. `KeyValueAnnotations` will add all of changes required for the new model automatically.
119118

120-
```yaml
121-
- name: 'annotations'
122-
type: KeyValueAnnotations
123-
description: |
124-
Client-specified annotations. This is distinct from labels.
125-
```
119+
```yaml
120+
- name: 'annotations'
121+
type: KeyValueAnnotations
122+
description: |
123+
Client-specified annotations. This is distinct from labels.
124+
```
126125
2. In the handwritten acceptance tests, add `annotations` to `ImportStateVerifyIgnore` if `annotations` field is in the configuration.
127126

128-
```go
129-
ImportStateVerifyIgnore: []string{"annotations"},
130-
```
127+
```go
128+
ImportStateVerifyIgnore: []string{"annotations"},
129+
```
131130
3. In the corresponding data source, after the resource read method, call the function `tpgresource.SetDataSourceAnnotations(d)` to make `annotations` have all of the annotations on the resource.
132131

133-
```go
134-
err = resourceSecretManagerSecretRead(d, meta)
135-
if err != nil {
136-
return err
137-
}
132+
```go
133+
err = resourceSecretManagerSecretRead(d, meta)
134+
if err != nil {
135+
return err
136+
}
138137
139-
if err := tpgresource.SetDataSourceLabels(d); err != nil {
140-
return err
141-
}
138+
if err := tpgresource.SetDataSourceLabels(d); err != nil {
139+
return err
140+
}
142141
143-
if err := tpgresource.SetDataSourceAnnotations(d); err != nil {
144-
return err
145-
}
146-
```
142+
if err := tpgresource.SetDataSourceAnnotations(d); err != nil {
143+
return err
144+
}
145+
```
147146

148147
### Handwritten resources
149148

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
22
title: "Breaking changes"
33
weight: 46
4+
params:
5+
bookCollapseSection: true
46
---

docs/content/breaking-changes/make-a-breaking-change.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ provider at runtime as well as in documentation.
8989

9090
#### Field deprecation (due to removal or rename)
9191

92-
{{< tabs "Field deprecations" >}}
92+
{{% tabs "Field deprecations" %}}
9393
{{< tab "MMv1" >}}
9494
Set `deprecation_message` on the field. For example:
9595

@@ -124,11 +124,11 @@ The deprecation message will automatically show up in the resource documentation
124124
* `api_field_name` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Deprecated) FIELD_DESCRIPTION. `api_field_name` is deprecated and will be removed in a future major release. Use `other_field_name` instead.
125125
```
126126
{{< /tab >}}
127-
{{< /tabs >}}
127+
{{% /tabs %}}
128128

129129
#### Resource deprecation (due to removal or rename)
130130

131-
{{< tabs "Resource deprecations" >}}
131+
{{% tabs "Resource deprecations" %}}
132132
{{< tab "MMv1" >}}
133133
Set `deprecation_message` on the resource. For example:
134134

@@ -165,7 +165,7 @@ The deprecation message will automatically show up in the resource documentation
165165
major release. Use `google_OTHER_RESOURCE_NAME` instead.
166166
```
167167
{{< /tab >}}
168-
{{< /tabs >}}
168+
{{% /tabs %}}
169169
170170
#### Other breaking changes
171171

0 commit comments

Comments
 (0)