Skip to content

Commit

Permalink
Fix up note on gcp.kms.CryptoKey to show Pulumi resource option (#2095
Browse files Browse the repository at this point in the history
)

Fixes #1879.
  • Loading branch information
guineveresaenger authored Jun 18, 2024
1 parent 6ab6154 commit 881cf3d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion provider/cmd/pulumi-resource-gcp/schema.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions provider/doc_edits.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gcp

import (
"bytes"
"fmt"
"math/rand"
"regexp"
Expand All @@ -10,6 +11,7 @@ import (

func editRules(defaults []tfbridge.DocsEdit) []tfbridge.DocsEdit {
return append(defaults,
fixUpKmsCryptoKey,
fixupEffectiveLabels,
removeSecretsInPlainTextNote,
removeBetaFromDescriptionField,
Expand Down Expand Up @@ -112,3 +114,20 @@ var rewritemembersField = tfbridge.DocsEdit{
return returnContent, nil
},
}

func targetedSimpleReplace(filePath, from, to string) tfbridge.DocsEdit {
fromB, toB := []byte(from), []byte(to)
return tfbridge.DocsEdit{
Path: filePath,
Edit: func(_ string, content []byte) ([]byte, error) {
return bytes.ReplaceAll(content, fromB, toB), nil
},
}
}

var fixUpKmsCryptoKey = targetedSimpleReplace(
"kms_crypto_key.html.markdown",
"For this reason, it is strongly recommended that you add\nlifecycle\nhooks "+
"to the resource to prevent accidental destruction.",
"For this reason, it is strongly recommended that you use "+
"Pulumi's [protect resource option](https://www.pulumi.com/docs/concepts/options/protect/).")
4 changes: 1 addition & 3 deletions sdk/dotnet/Kms/CryptoKey.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions sdk/go/gcp/kms/cryptoKey.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions sdk/java/src/main/java/com/pulumi/gcp/kms/CryptoKey.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions sdk/nodejs/kms/cryptoKey.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions sdk/python/pulumi_gcp/kms/crypto_key.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 881cf3d

Please sign in to comment.