Skip to content

Commit

Permalink
Add deprecation note to provider landing page for recently deprecated…
Browse files Browse the repository at this point in the history
… providers" (#2883)

This pull request adds a list of deprecated providers to the landing
page docsgen so that the page can display a deprecation warning with
relevant links.

Currently, the list only contains pulumi-civo; we will add to it as we
deprecate.

Part of pulumi/pulumi-civo#696.

Screenshot of expected landing page as soon as we add Civo to the list
of dynamically bridged providers:

<img width="826" alt="Screenshot 2025-02-03 at 1 58 31 PM"
src="https://github.com/user-attachments/assets/b574aafe-e4e2-4f95-b06d-88cb84bf7cda"
/>


- **Add deprecation note to installation instructions and add Civo to a
hardcoded list of recently-deprecated**
- **Add test to show that a provider returned by
getDeprecateProviderNames contains a deprecation note**
  • Loading branch information
guineveresaenger authored Feb 4, 2025
2 parents a801f99 + ae3dee6 commit 908e7f7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/tfgen/installation_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,32 @@ func writeInstallationInstructions(goImportBasePath, displayName, pkgName, ghOrg
pkgName,
)

deprecatedNote := fmt.Sprintf("~> **NOTE:** This provider was previously published as @pulumi/%[1]s.\n"+
"However, that package is no longer being updated."+
"Going forward, it is available as a [Local Package](https://www.pulumi.com/blog/any-terraform-provider/)"+
" instead.\n"+
"Please see the [provider's repository](https://github.com/pulumi/pulumi-%[1]s) for details.\n\n", pkgName)

if strings.Contains(sourceRepo, "pulumi") {
return installInstructions
}
for _, provider := range getDeprecatedProviderNames() {
if provider == pkgName {
// append the deprecation note
generateInstructions = generateInstructions + deprecatedNote
}
}
return generateInstructions
}

// TODO: remove this note after 90 days: https://github.com/pulumi/pulumi-terraform-bridge/issues/2885
func getDeprecatedProviderNames() []string {
providerNames := []string{
"civo",
}
return providerNames
}

func getOverviewHeader(content []byte) string {
const overviewHeader = "## Overview\n\n"
// If content starts with an H2, or is otherwise empty then we don't want to add this header
Expand Down
18 changes: 18 additions & 0 deletions pkg/tfgen/installation_docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,24 @@ func TestWriteInstallationInstructions(t *testing.T) {
repository: "terraform-provider-testcase",
ghOrg: "unicorncorp",
},
{
name: "Generates Deprecation Note If Provider on Deprecated List",
expected: autogold.Expect(
"## Generate Provider\n\n" +
"The Civo provider must be installed as a Local Package by following the " +
"[instructions for Any Terraform Provider](https://www.pulumi.com/registry/packages/terraform-provider/):\n\n" +
"```bash\npulumi package add terraform-provider civo/civo\n```\n" +
"~> **NOTE:** This provider was previously published as @pulumi/civo.\n" +
"However, that package is no longer being updated." +
"Going forward, it is available as a [Local Package](https://www.pulumi.com/blog/any-terraform-provider/) " +
"instead.\n" +
"Please see the [provider's repository](https://github.com/pulumi/pulumi-civo) for details.\n\n"),
goImportBasePath: "github.com/pulumi/pulumi-testcase/sdk/v3/go/pulumi-testcase",
displayName: "Civo",
packageName: "civo",
repository: "terraform-provider-civo",
ghOrg: "civo",
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 908e7f7

Please sign in to comment.