Skip to content

Commit

Permalink
Replace "Managed by Terraform" in our docs (#2611)
Browse files Browse the repository at this point in the history
Fixes #2610
  • Loading branch information
iwahbe authored Nov 13, 2024
1 parent e0fa71e commit 77577d0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/tfgen/edit_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func defaultEditRules() editRules {
fixupImports(),
// Replace content such as "[email protected]" with "[email protected]"
reReplace("@hashicorp.com", "@example.com", info.PreCodeTranslation),
reReplace(`"Managed by Terraform"`, `"Managed by Pulumi"`, info.PreCodeTranslation),

// The following edit rules may be applied after translating the code sections in a document.
// Their primary use case is for the docs translation approach spearheaded in installation_docs.go.
Expand Down
30 changes: 30 additions & 0 deletions pkg/tfgen/edit_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,36 @@ func TestApplyEditRules(t *testing.T) {
expected: []byte("# Configuration Reference"),
phase: info.PostCodeTranslation,
},
{
// Found in azuredevops: https://github.com/pulumi/pulumi-terraform-bridge/issues/2610
name: `Replaces "Managed by Terraform" with "Manged by Pulumi"`,
docFile: DocFile{
Content: []byte(`
const example = new azuredevops.Project("example", {
description: "Managed by Terraform",
});
`),
},
expected: []byte(`
const example = new azuredevops.Project("example", {
description: "Managed by Pulumi",
});
`),
},
{
name: "Does not replace \"Managed by Terraform\" with \"Manged by Pulumi\" (require quotes)",
// It's harder to tell if Managed by Terraform would sense to replace, so we don't do it for now.
//
// We don't have a canonical example where this does not work.
docFile: DocFile{
Content: []byte(`
This Resource is Managed by Terraform
`),
},
expected: []byte(`
This Resource is Managed by Terraform
`),
},
}
edits := defaultEditRules()

Expand Down

0 comments on commit 77577d0

Please sign in to comment.