diff --git a/Makefile b/Makefile index 058dfc354e..4dc0d053d5 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ export PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION := true PROJECT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) install_plugins:: - pulumi plugin install converter terraform 1.0.19 + pulumi plugin install converter terraform 1.0.20 pulumi plugin install resource random 4.16.3 pulumi plugin install resource aws 6.22.2 pulumi plugin install resource archive 0.0.4 diff --git a/dynamic/main.go b/dynamic/main.go index 23af820e22..61e1750de9 100644 --- a/dynamic/main.go +++ b/dynamic/main.go @@ -21,16 +21,15 @@ import ( "os" "os/exec" - "github.com/pkg/errors" - "github.com/spf13/afero" - "github.com/blang/semver" "github.com/opentofu/opentofu/shim/run" + "github.com/pkg/errors" "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/spf13/afero" "github.com/pulumi/pulumi-terraform-bridge/dynamic/parameterize" "github.com/pulumi/pulumi-terraform-bridge/dynamic/version" diff --git a/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden b/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden index 8e476b560d..1a29b77bd9 100644 --- a/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden +++ b/dynamic/testdata/TestSchemaGeneration/Backblaze/b2-0.8.9.golden @@ -1,8 +1,8 @@ { "name": "b2", - "version": "0.8.9", "description": "A Pulumi provider dynamically bridged from b2.", "attribution": "This Pulumi package is based on the [`b2` Terraform Provider](https://github.com/backblaze/terraform-provider-b2).", + "repository": "https://github.com/backblaze/terraform-provider-b2", "publisher": "Pulumi", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" @@ -28,14 +28,14 @@ }, "nodejs": { "packageDescription": "A Pulumi provider dynamically bridged from b2.", - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/backblaze/terraform-provider-b2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-b2` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-b2` repo](https://github.com/backblaze/terraform-provider-b2/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/backblaze/terraform-provider-b2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-b2` repo](https://github.com/backblaze/terraform-provider-b2/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true, "liftSingleValueMethodReturns": true, "respectSchemaVersion": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/backblaze/terraform-provider-b2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-b2` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-b2` repo](https://github.com/backblaze/terraform-provider-b2/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/backblaze/terraform-provider-b2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-b2` repo](https://github.com/backblaze/terraform-provider-b2/issues).", "compatibility": "tfbridge20", "respectSchemaVersion": true, "pyproject": { diff --git a/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden b/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden index 453bbea0ea..2e67c2b067 100644 --- a/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden +++ b/dynamic/testdata/TestSchemaGeneration/databricks/databricks-1.50.0.golden @@ -1,8 +1,8 @@ { "name": "databricks", - "version": "1.50.0", "description": "A Pulumi provider dynamically bridged from databricks.", "attribution": "This Pulumi package is based on the [`databricks` Terraform Provider](https://github.com/databricks/terraform-provider-databricks).", + "repository": "https://github.com/databricks/terraform-provider-databricks", "publisher": "Pulumi", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" @@ -28,14 +28,14 @@ }, "nodejs": { "packageDescription": "A Pulumi provider dynamically bridged from databricks.", - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/databricks/terraform-provider-databricks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-databricks` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-databricks` repo](https://github.com/databricks/terraform-provider-databricks/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/databricks/terraform-provider-databricks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-databricks` repo](https://github.com/databricks/terraform-provider-databricks/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true, "liftSingleValueMethodReturns": true, "respectSchemaVersion": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/databricks/terraform-provider-databricks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-databricks` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-databricks` repo](https://github.com/databricks/terraform-provider-databricks/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/databricks/terraform-provider-databricks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-databricks` repo](https://github.com/databricks/terraform-provider-databricks/issues).", "compatibility": "tfbridge20", "respectSchemaVersion": true, "pyproject": { diff --git a/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden b/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden index 1d5685ada2..2702557908 100644 --- a/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden +++ b/dynamic/testdata/TestSchemaGeneration/hashicorp/random-3.3.0.golden @@ -1,8 +1,8 @@ { "name": "random", - "version": "3.3.0", "description": "A Pulumi provider dynamically bridged from random.", "attribution": "This Pulumi package is based on the [`random` Terraform Provider](https://github.com/hashicorp/terraform-provider-random).", + "repository": "https://github.com/hashicorp/terraform-provider-random", "publisher": "Pulumi", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" @@ -28,14 +28,14 @@ }, "nodejs": { "packageDescription": "A Pulumi provider dynamically bridged from random.", - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-random` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true, "liftSingleValueMethodReturns": true, "respectSchemaVersion": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-random` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", "compatibility": "tfbridge20", "respectSchemaVersion": true, "pyproject": { diff --git a/dynamic/testdata/TestSchemaGeneration/unparameterized.golden b/dynamic/testdata/TestSchemaGeneration/unparameterized.golden index 8809cef0ff..45c104ce01 100644 --- a/dynamic/testdata/TestSchemaGeneration/unparameterized.golden +++ b/dynamic/testdata/TestSchemaGeneration/unparameterized.golden @@ -1,7 +1,6 @@ { "name": "terraform-provider", "displayName": "Any Terraform Provider", - "version": "v0.0.0-dev", "description": "Use any Terraform provider with Pulumi", "keywords": [ "category/utility" diff --git a/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden b/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden index ba4a159577..cac441f13a 100644 --- a/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden +++ b/dynamic/testdata/TestSchemaGenerationFullDocs/hashicorp/random-3.6.3.golden @@ -1,8 +1,8 @@ { "name": "random", - "version": "3.6.3", "description": "A Pulumi provider dynamically bridged from random.", "attribution": "This Pulumi package is based on the [`random` Terraform Provider](https://github.com/hashicorp/terraform-provider-random).", + "repository": "https://github.com/hashicorp/terraform-provider-random", "publisher": "Pulumi", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" @@ -28,14 +28,14 @@ }, "nodejs": { "packageDescription": "A Pulumi provider dynamically bridged from random.", - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-random` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true, "liftSingleValueMethodReturns": true, "respectSchemaVersion": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-random` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/hashicorp/terraform-provider-random)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-random` repo](https://github.com/hashicorp/terraform-provider-random/issues).", "compatibility": "tfbridge20", "respectSchemaVersion": true, "pyproject": { @@ -49,7 +49,7 @@ }, "resources": { "random:index/bytes:Bytes": { - "description": "The resource `random.Bytes` generates random bytes that are intended to be used as a secret, or key. Use this in preference to `random.Id` when the output is considered sensitive, and should not be displayed in the CLI.\n\nThis resource *does* use a cryptographic random number generator.\n\n## Example Usage\n\n```terraform\nresource \"random_bytes\" \"jwt_secret\" {\n length = 64\n}\n\nresource \"azurerm_key_vault_secret\" \"jwt_secret\" {\n key_vault_id = \"some-azure-key-vault-id\"\n name = \"JwtSecret\"\n value = random_bytes.jwt_secret.base64\n}\n```\n\n## Import\n\nRandom bytes can be imported by specifying the value as base64 string.\n\n```sh\n$ pulumi import random:index/bytes:Bytes basic \"8/fu3q+2DcgSJ19i0jZ5Cw==\"\n```\n\n", + "description": "The resource `random.Bytes` generates random bytes that are intended to be used as a secret, or key. Use this in preference to `random.Id` when the output is considered sensitive, and should not be displayed in the CLI.\n\nThis resource *does* use a cryptographic random number generator.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as azurerm from \"@pulumi/azurerm\";\nimport * as random from \"@pulumi/random\";\n\nconst jwtSecretBytes = new random.Bytes(\"jwtSecretBytes\", {length: 64});\nconst jwtSecretazurerm_key_vault_secret = new azurerm.index.Azurerm_key_vault_secret(\"jwtSecretazurerm_key_vault_secret\", {\n keyVaultId: \"some-azure-key-vault-id\",\n name: \"JwtSecret\",\n value: jwtSecretBytes.base64,\n});\n```\n```python\nimport pulumi\nimport pulumi_azurerm as azurerm\nimport pulumi_random as random\n\njwt_secret_bytes = random.Bytes(\"jwtSecretBytes\", length=64)\njwt_secretazurerm_key_vault_secret = azurerm.index.Azurerm_key_vault_secret(\"jwtSecretazurerm_key_vault_secret\",\n key_vault_id=some-azure-key-vault-id,\n name=JwtSecret,\n value=jwt_secret_bytes.base64)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Azurerm = Pulumi.Azurerm;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var jwtSecretBytes = new Random.Bytes(\"jwtSecretBytes\", new()\n {\n Length = 64,\n });\n\n var jwtSecretazurerm_key_vault_secret = new Azurerm.Index.Azurerm_key_vault_secret(\"jwtSecretazurerm_key_vault_secret\", new()\n {\n KeyVaultId = \"some-azure-key-vault-id\",\n Name = \"JwtSecret\",\n Value = jwtSecretBytes.Base64,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-azurerm/sdk/go/azurerm\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\tjwtSecretBytes, err := random.NewBytes(ctx, \"jwtSecretBytes\", \u0026random.BytesArgs{\n\t\t\tLength: pulumi.Float64(64),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = azurerm.NewAzurerm_key_vault_secret(ctx, \"jwtSecretazurerm_key_vault_secret\", \u0026azurerm.Azurerm_key_vault_secretArgs{\n\t\t\tKeyVaultId: \"some-azure-key-vault-id\",\n\t\t\tName: \"JwtSecret\",\n\t\t\tValue: jwtSecretBytes.Base64,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Bytes;\nimport com.pulumi.random.BytesArgs;\nimport com.pulumi.azurerm.azurerm_key_vault_secret;\nimport com.pulumi.azurerm.Azurerm_key_vault_secretArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var jwtSecretBytes = new Bytes(\"jwtSecretBytes\", BytesArgs.builder()\n .length(64)\n .build());\n\n var jwtSecretazurerm_key_vault_secret = new Azurerm_key_vault_secret(\"jwtSecretazurerm_key_vault_secret\", Azurerm_key_vault_secretArgs.builder()\n .keyVaultId(\"some-azure-key-vault-id\")\n .name(\"JwtSecret\")\n .value(jwtSecretBytes.base64())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n jwtSecretBytes:\n type: random:Bytes\n properties:\n length: 64\n jwtSecretazurerm_key_vault_secret:\n type: azurerm:azurerm_key_vault_secret\n properties:\n keyVaultId: some-azure-key-vault-id\n name: JwtSecret\n value: ${jwtSecretBytes.base64}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## Import\n\nRandom bytes can be imported by specifying the value as base64 string.\n\n```sh\n$ pulumi import random:index/bytes:Bytes basic \"8/fu3q+2DcgSJ19i0jZ5Cw==\"\n```\n\n", "properties": { "base64": { "type": "string", @@ -123,7 +123,7 @@ } }, "random:index/id:Id": { - "description": "The resource `random.Id` generates random numbers that are intended to be\nused as unique identifiers for other resources. If the output is considered \nsensitive, and should not be displayed in the CLI, use `random.Bytes`\ninstead.\n\nThis resource *does* use a cryptographic random number generator in order\nto minimize the chance of collisions, making the results of this resource\nwhen a 16-byte identifier is requested of equivalent uniqueness to a\ntype-4 UUID.\n\nThis resource can be used in conjunction with resources that have\nthe `create_before_destroy` lifecycle flag set to avoid conflicts with\nunique names during the brief period where both the old and new resources\nexist concurrently.\n\n## Example Usage\n\n```terraform\n# The following example shows how to generate a unique name for an AWS EC2\n# instance that changes each time a new AMI id is selected.\n\nresource \"random_id\" \"server\" {\n keepers = {\n # Generate a new id each time we switch to a new AMI id\n ami_id = var.ami_id\n }\n\n byte_length = 8\n}\n\nresource \"aws_instance\" \"server\" {\n tags = {\n Name = \"web-server ${random_id.server.hex}\"\n }\n\n # Read the AMI id \"through\" the random_id resource to ensure that\n # both will change together.\n ami = random_id.server.keepers.ami_id\n\n # ... (other aws_instance arguments) ...\n}\n```\n\n## Import\n\nRandom IDs can be imported using the b64_url with an optional prefix. This\n\ncan be used to replace a config value with a value interpolated from the\n\nrandom provider without experiencing diffs.\n\nExample with no prefix:\n\n```sh\n$ pulumi import random:index/id:Id server p-9hUg\n```\n\nExample with prefix (prefix is separated by a ,):\n\n```sh\n$ pulumi import random:index/id:Id server my-prefix-,p-9hUg\n```\n\n", + "description": "The resource `random.Id` generates random numbers that are intended to be\nused as unique identifiers for other resources. If the output is considered \nsensitive, and should not be displayed in the CLI, use `random.Bytes`\ninstead.\n\nThis resource *does* use a cryptographic random number generator in order\nto minimize the chance of collisions, making the results of this resource\nwhen a 16-byte identifier is requested of equivalent uniqueness to a\ntype-4 UUID.\n\nThis resource can be used in conjunction with resources that have\nthe `create_before_destroy` lifecycle flag set to avoid conflicts with\nunique names during the brief period where both the old and new resources\nexist concurrently.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\n\n// The following example shows how to generate a unique name for an AWS EC2\n// instance that changes each time a new AMI id is selected.\nconst serverId = new random.Id(\"serverId\", {\n keepers: {\n ami_id: _var.ami_id,\n },\n byteLength: 8,\n});\nconst serverInstance = new aws.ec2.Instance(\"serverInstance\", {\n tags: {\n Name: pulumi.interpolate`web-server ${serverId.hex}`,\n },\n ami: serverId.keepers.apply(keepers =\u003e keepers?.amiId),\n});\n// ... (other aws_instance arguments) ...\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\nimport pulumi_random as random\n\n# The following example shows how to generate a unique name for an AWS EC2\n# instance that changes each time a new AMI id is selected.\nserver_id = random.Id(\"serverId\",\n keepers={\n \"ami_id\": var[\"ami_id\"],\n },\n byte_length=8)\nserver_instance = aws.ec2.Instance(\"serverInstance\",\n tags={\n \"Name\": server_id.hex.apply(lambda hex: f\"web-server {hex}\"),\n },\n ami=server_id.keepers[\"amiId\"])\n# ... (other aws_instance arguments) ...\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n // The following example shows how to generate a unique name for an AWS EC2\n // instance that changes each time a new AMI id is selected.\n var serverId = new Random.Id(\"serverId\", new()\n {\n Keepers = \n {\n { \"ami_id\", @var.Ami_id },\n },\n ByteLength = 8,\n });\n\n var serverInstance = new Aws.Ec2.Instance(\"serverInstance\", new()\n {\n Tags = \n {\n { \"Name\", serverId.Hex.Apply(hex =\u003e $\"web-server {hex}\") },\n },\n Ami = serverId.Keepers.Apply(keepers =\u003e keepers?.AmiId),\n });\n\n // ... (other aws_instance arguments) ...\n});\n```\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t// The following example shows how to generate a unique name for an AWS EC2\n\t\t// instance that changes each time a new AMI id is selected.\n\t\tserverId, err := random.NewId(ctx, \"serverId\", \u0026random.IdArgs{\n\t\t\tKeepers: pulumi.StringMap{\n\t\t\t\t\"ami_id\": pulumi.Any(_var.Ami_id),\n\t\t\t},\n\t\t\tByteLength: pulumi.Float64(8),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = ec2.NewInstance(ctx, \"serverInstance\", \u0026ec2.InstanceArgs{\n\t\t\tTags: pulumi.StringMap{\n\t\t\t\t\"Name\": serverId.Hex.ApplyT(func(hex string) (string, error) {\n\t\t\t\t\treturn fmt.Sprintf(\"web-server %v\", hex), nil\n\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t},\n\t\t\tAmi: pulumi.String(serverId.Keepers.ApplyT(func(keepers map[string]string) (*string, error) {\n\t\t\t\treturn \u0026keepers.AmiId, nil\n\t\t\t}).(pulumi.StringPtrOutput)),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Id;\nimport com.pulumi.random.IdArgs;\nimport com.pulumi.aws.ec2.Instance;\nimport com.pulumi.aws.ec2.InstanceArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n // The following example shows how to generate a unique name for an AWS EC2\n // instance that changes each time a new AMI id is selected.\n var serverId = new Id(\"serverId\", IdArgs.builder()\n .keepers(Map.of(\"ami_id\", var_.ami_id()))\n .byteLength(8)\n .build());\n\n var serverInstance = new Instance(\"serverInstance\", InstanceArgs.builder()\n .tags(Map.of(\"Name\", serverId.hex().applyValue(hex -\u003e String.format(\"web-server %s\", hex))))\n .ami(serverId.keepers().applyValue(keepers -\u003e keepers.amiId()))\n .build());\n\n // ... (other aws_instance arguments) ...\n }\n}\n```\n```yaml\nresources:\n # The following example shows how to generate a unique name for an AWS EC2\n # instance that changes each time a new AMI id is selected.\n serverId:\n type: random:Id\n properties:\n keepers:\n ami_id: ${var.ami_id}\n byteLength: 8\n serverInstance:\n type: aws:ec2:Instance\n properties:\n tags:\n Name: web-server ${serverId.hex}\n # Read the AMI id \"through\" the random_id resource to ensure that\n # # both will change together.\n ami: ${serverId.keepers.amiId}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## Import\n\nRandom IDs can be imported using the b64_url with an optional prefix. This\n\ncan be used to replace a config value with a value interpolated from the\n\nrandom provider without experiencing diffs.\n\nExample with no prefix:\n\n```sh\n$ pulumi import random:index/id:Id server p-9hUg\n```\n\nExample with prefix (prefix is separated by a ,):\n\n```sh\n$ pulumi import random:index/id:Id server my-prefix-,p-9hUg\n```\n\n", "properties": { "b64Std": { "type": "string", @@ -223,7 +223,7 @@ } }, "random:index/integer:Integer": { - "description": "The resource `random.Integer` generates random values from a given range, described by the `min` and `max` attributes of a given resource.\n\nThis resource can be used in conjunction with resources that have the `create_before_destroy` lifecycle flag set, to avoid conflicts with unique names during the brief period where both the old and new resources exist concurrently.\n\n## Example Usage\n\n```terraform\n# The following example shows how to generate a random priority\n# between 1 and 50000 for a aws_alb_listener_rule resource:\n\nresource \"random_integer\" \"priority\" {\n min = 1\n max = 50000\n keepers = {\n # Generate a new integer each time we switch to a new listener ARN\n listener_arn = var.listener_arn\n }\n}\n\nresource \"aws_alb_listener_rule\" \"main\" {\n listener_arn = random_integer.priority.keepers.listener_arn\n priority = random_integer.priority.result\n\n action {\n type = \"forward\"\n target_group_arn = var.target_group_arn\n }\n # ... (other aws_alb_listener_rule arguments) ...\n}\n```\n\n## Import\n\nRandom integers can be imported using the result, min, and max, with an\n\noptional seed. This can be used to replace a config value with a value\n\ninterpolated from the random provider without experiencing diffs.\n\nExample (values are separated by a ,):\n\n```sh\n$ pulumi import random:index/integer:Integer priority 15390,1,50000\n```\n\n", + "description": "The resource `random.Integer` generates random values from a given range, described by the `min` and `max` attributes of a given resource.\n\nThis resource can be used in conjunction with resources that have the `create_before_destroy` lifecycle flag set, to avoid conflicts with unique names during the brief period where both the old and new resources exist concurrently.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\n\n// The following example shows how to generate a random priority\n// between 1 and 50000 for a aws_alb_listener_rule resource:\nconst priority = new random.Integer(\"priority\", {\n min: 1,\n max: 50000,\n keepers: {\n listener_arn: _var.listener_arn,\n },\n});\nconst main = new aws.alb.ListenerRule(\"main\", {\n listenerArn: priority.keepers.apply(keepers =\u003e keepers?.listenerArn),\n priority: priority.result,\n actions: [{\n type: \"forward\",\n targetGroupArn: _var.target_group_arn,\n }],\n});\n// ... (other aws_alb_listener_rule arguments) ...\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\nimport pulumi_random as random\n\n# The following example shows how to generate a random priority\n# between 1 and 50000 for a aws_alb_listener_rule resource:\npriority = random.Integer(\"priority\",\n min=1,\n max=50000,\n keepers={\n \"listener_arn\": var[\"listener_arn\"],\n })\nmain = aws.alb.ListenerRule(\"main\",\n listener_arn=priority.keepers[\"listenerArn\"],\n priority=priority.result,\n actions=[{\n \"type\": \"forward\",\n \"target_group_arn\": var[\"target_group_arn\"],\n }])\n# ... (other aws_alb_listener_rule arguments) ...\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n // The following example shows how to generate a random priority\n // between 1 and 50000 for a aws_alb_listener_rule resource:\n var priority = new Random.Integer(\"priority\", new()\n {\n Min = 1,\n Max = 50000,\n Keepers = \n {\n { \"listener_arn\", @var.Listener_arn },\n },\n });\n\n var main = new Aws.Alb.ListenerRule(\"main\", new()\n {\n ListenerArn = priority.Keepers.Apply(keepers =\u003e keepers?.ListenerArn),\n Priority = priority.Result,\n Actions = new[]\n {\n new Aws.Alb.Inputs.ListenerRuleActionArgs\n {\n Type = \"forward\",\n TargetGroupArn = @var.Target_group_arn,\n },\n },\n });\n\n // ... (other aws_alb_listener_rule arguments) ...\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/alb\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t// The following example shows how to generate a random priority\n\t\t// between 1 and 50000 for a aws_alb_listener_rule resource:\n\t\tpriority, err := random.NewInteger(ctx, \"priority\", \u0026random.IntegerArgs{\n\t\t\tMin: pulumi.Float64(1),\n\t\t\tMax: pulumi.Float64(50000),\n\t\t\tKeepers: pulumi.StringMap{\n\t\t\t\t\"listener_arn\": pulumi.Any(_var.Listener_arn),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = alb.NewListenerRule(ctx, \"main\", \u0026alb.ListenerRuleArgs{\n\t\t\tListenerArn: pulumi.String(priority.Keepers.ApplyT(func(keepers map[string]string) (*string, error) {\n\t\t\t\treturn \u0026keepers.ListenerArn, nil\n\t\t\t}).(pulumi.StringPtrOutput)),\n\t\t\tPriority: priority.Result,\n\t\t\tActions: alb.ListenerRuleActionArray{\n\t\t\t\t\u0026alb.ListenerRuleActionArgs{\n\t\t\t\t\tType: pulumi.String(\"forward\"),\n\t\t\t\t\tTargetGroupArn: pulumi.Any(_var.Target_group_arn),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Integer;\nimport com.pulumi.random.IntegerArgs;\nimport com.pulumi.aws.alb.ListenerRule;\nimport com.pulumi.aws.alb.ListenerRuleArgs;\nimport com.pulumi.aws.alb.inputs.ListenerRuleActionArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n // The following example shows how to generate a random priority\n // between 1 and 50000 for a aws_alb_listener_rule resource:\n var priority = new Integer(\"priority\", IntegerArgs.builder()\n .min(1)\n .max(50000)\n .keepers(Map.of(\"listener_arn\", var_.listener_arn()))\n .build());\n\n var main = new ListenerRule(\"main\", ListenerRuleArgs.builder()\n .listenerArn(priority.keepers().applyValue(keepers -\u003e keepers.listenerArn()))\n .priority(priority.result())\n .actions(ListenerRuleActionArgs.builder()\n .type(\"forward\")\n .targetGroupArn(var_.target_group_arn())\n .build())\n .build());\n\n // ... (other aws_alb_listener_rule arguments) ...\n }\n}\n```\n```yaml\nresources:\n # The following example shows how to generate a random priority\n # between 1 and 50000 for a aws_alb_listener_rule resource:\n priority:\n type: random:Integer\n properties:\n min: 1\n max: 50000\n keepers:\n listener_arn: ${var.listener_arn}\n main:\n type: aws:alb:ListenerRule\n properties:\n listenerArn: ${priority.keepers.listenerArn}\n priority: ${priority.result}\n actions:\n - type: forward\n targetGroupArn: ${var.target_group_arn}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## Import\n\nRandom integers can be imported using the result, min, and max, with an\n\noptional seed. This can be used to replace a config value with a value\n\ninterpolated from the random provider without experiencing diffs.\n\nExample (values are separated by a ,):\n\n```sh\n$ pulumi import random:index/integer:Integer priority 15390,1,50000\n```\n\n", "properties": { "keepers": { "type": "object", @@ -310,7 +310,7 @@ } }, "random:index/password:Password": { - "description": "## Example Usage\n\n```terraform\nresource \"random_password\" \"password\" {\n length = 16\n special = true\n override_special = \"!#$%\u0026*()-_=+[]{}\u003c\u003e:?\"\n}\n\nresource \"aws_db_instance\" \"example\" {\n instance_class = \"db.t3.micro\"\n allocated_storage = 64\n engine = \"mysql\"\n username = \"someone\"\n password = random_password.password.result\n}\n```\n\n## Import\n\n### Avoiding Replacement\n\n```sh\n$ pulumi import random:index/password:Password If the resource were imported using `random_password.password securepassword`,\n```\n\nreplacement could be avoided by using:\n\n1. Attribute values that match the imported ID and defaults:\n\n terraform\n\n resource \"random_password\" \"password\" {\n\n length = 14\n\n lower = true\n\n }\n\n2. Attribute values that match the imported ID and omit the attributes with defaults:\n\n terraform\n\n resource \"random_password\" \"password\" {\n\n length = 14\n\n }\n\n3. `ignore_changes` specifying the attributes to ignore:\n\n terraform\n\n resource \"random_password\" \"password\" {\n\n length = 16\n\n lower = false\n\n lifecycle {\n\n ignore_changes = [\n\n length,\n\n lower,\n\n ]\n\n }\n\n }\n\n **NOTE** `ignore_changes` is only required until the resource is recreated after import,\n\n after which it will use the configuration values specified.\n\n", + "description": "## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\n\nconst password = new random.Password(\"password\", {\n length: 16,\n special: true,\n overrideSpecial: \"!#$%\u0026*()-_=+[]{}\u003c\u003e:?\",\n});\nconst example = new aws.rds.Instance(\"example\", {\n instanceClass: aws.rds.InstanceType.T3_Micro,\n allocatedStorage: 64,\n engine: \"mysql\",\n username: \"someone\",\n password: password.result,\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\nimport pulumi_random as random\n\npassword = random.Password(\"password\",\n length=16,\n special=True,\n override_special=\"!#$%\u0026*()-_=+[]{}\u003c\u003e:?\")\nexample = aws.rds.Instance(\"example\",\n instance_class=aws.rds.InstanceType.T3_MICRO,\n allocated_storage=64,\n engine=\"mysql\",\n username=\"someone\",\n password=password.result)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var password = new Random.Password(\"password\", new()\n {\n Length = 16,\n Special = true,\n OverrideSpecial = \"!#$%\u0026*()-_=+[]{}\u003c\u003e:?\",\n });\n\n var example = new Aws.Rds.Instance(\"example\", new()\n {\n InstanceClass = Aws.Rds.InstanceType.T3_Micro,\n AllocatedStorage = 64,\n Engine = \"mysql\",\n Username = \"someone\",\n Password = password.Result,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\tpassword, err := random.NewPassword(ctx, \"password\", \u0026random.PasswordArgs{\n\t\t\tLength: pulumi.Float64(16),\n\t\t\tSpecial: pulumi.Bool(true),\n\t\t\tOverrideSpecial: pulumi.String(\"!#$%\u0026*()-_=+[]{}\u003c\u003e:?\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = rds.NewInstance(ctx, \"example\", \u0026rds.InstanceArgs{\n\t\t\tInstanceClass: pulumi.String(rds.InstanceType_T3_Micro),\n\t\t\tAllocatedStorage: pulumi.Int(64),\n\t\t\tEngine: pulumi.String(\"mysql\"),\n\t\t\tUsername: pulumi.String(\"someone\"),\n\t\t\tPassword: password.Result,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Password;\nimport com.pulumi.random.PasswordArgs;\nimport com.pulumi.aws.rds.Instance;\nimport com.pulumi.aws.rds.InstanceArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var password = new Password(\"password\", PasswordArgs.builder()\n .length(16)\n .special(true)\n .overrideSpecial(\"!#$%\u0026*()-_=+[]{}\u003c\u003e:?\")\n .build());\n\n var example = new Instance(\"example\", InstanceArgs.builder()\n .instanceClass(\"db.t3.micro\")\n .allocatedStorage(64)\n .engine(\"mysql\")\n .username(\"someone\")\n .password(password.result())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n password:\n type: random:Password\n properties:\n length: 16\n special: true\n overrideSpecial: '!#$%\u0026*()-_=+[]{}\u003c\u003e:?'\n example:\n type: aws:rds:Instance\n properties:\n instanceClass: db.t3.micro\n allocatedStorage: 64\n engine: mysql\n username: someone\n password: ${password.result}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## Import\n\n### Avoiding Replacement\n\n```sh\n$ pulumi import random:index/password:Password If the resource were imported using `random_password.password securepassword`,\n```\n\nreplacement could be avoided by using:\n\n1. Attribute values that match the imported ID and defaults:\n\n terraform\n\n resource \"random_password\" \"password\" {\n\n length = 14\n\n lower = true\n\n }\n\n2. Attribute values that match the imported ID and omit the attributes with defaults:\n\n terraform\n\n resource \"random_password\" \"password\" {\n\n length = 14\n\n }\n\n3. `ignore_changes` specifying the attributes to ignore:\n\n terraform\n\n resource \"random_password\" \"password\" {\n\n length = 16\n\n lower = false\n\n lifecycle {\n\n ignore_changes = [\n\n length,\n\n lower,\n\n ]\n\n }\n\n }\n\n **NOTE** `ignore_changes` is only required until the resource is recreated after import,\n\n after which it will use the configuration values specified.\n\n", "properties": { "bcryptHash": { "type": "string", @@ -516,7 +516,7 @@ } }, "random:index/pet:Pet": { - "description": "The resource `random.Pet` generates random pet names that are intended to be used as unique identifiers for other resources.\n\nThis resource can be used in conjunction with resources that have the `create_before_destroy` lifecycle flag set, to avoid conflicts with unique names during the brief period where both the old and new resources exist concurrently.\n\n## Example Usage\n\n```terraform\n# The following example shows how to generate a unique pet name\n# for an AWS EC2 instance that changes each time a new AMI id is\n# selected.\n\nresource \"random_pet\" \"server\" {\n keepers = {\n # Generate a new pet name each time we switch to a new AMI id\n ami_id = var.ami_id\n }\n}\n\nresource \"aws_instance\" \"server\" {\n tags = {\n Name = \"web-server-${random_pet.server.id}\"\n }\n\n # Read the AMI id \"through\" the random_pet resource to ensure that\n # both will change together.\n ami = random_pet.server.keepers.ami_id\n\n # ... (other aws_instance arguments) ...\n}\n```\n", + "description": "The resource `random.Pet` generates random pet names that are intended to be used as unique identifiers for other resources.\n\nThis resource can be used in conjunction with resources that have the `create_before_destroy` lifecycle flag set, to avoid conflicts with unique names during the brief period where both the old and new resources exist concurrently.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\n\n// The following example shows how to generate a unique pet name\n// for an AWS EC2 instance that changes each time a new AMI id is\n// selected.\nconst serverPet = new random.Pet(\"serverPet\", {keepers: {\n ami_id: _var.ami_id,\n}});\nconst serverInstance = new aws.ec2.Instance(\"serverInstance\", {\n tags: {\n Name: pulumi.interpolate`web-server-${serverPet.id}`,\n },\n ami: serverPet.keepers.apply(keepers =\u003e keepers?.amiId),\n});\n// ... (other aws_instance arguments) ...\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\nimport pulumi_random as random\n\n# The following example shows how to generate a unique pet name\n# for an AWS EC2 instance that changes each time a new AMI id is\n# selected.\nserver_pet = random.Pet(\"serverPet\", keepers={\n \"ami_id\": var[\"ami_id\"],\n})\nserver_instance = aws.ec2.Instance(\"serverInstance\",\n tags={\n \"Name\": server_pet.id.apply(lambda id: f\"web-server-{id}\"),\n },\n ami=server_pet.keepers[\"amiId\"])\n# ... (other aws_instance arguments) ...\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n // The following example shows how to generate a unique pet name\n // for an AWS EC2 instance that changes each time a new AMI id is\n // selected.\n var serverPet = new Random.Pet(\"serverPet\", new()\n {\n Keepers = \n {\n { \"ami_id\", @var.Ami_id },\n },\n });\n\n var serverInstance = new Aws.Ec2.Instance(\"serverInstance\", new()\n {\n Tags = \n {\n { \"Name\", serverPet.Id.Apply(id =\u003e $\"web-server-{id}\") },\n },\n Ami = serverPet.Keepers.Apply(keepers =\u003e keepers?.AmiId),\n });\n\n // ... (other aws_instance arguments) ...\n});\n```\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t// The following example shows how to generate a unique pet name\n\t\t// for an AWS EC2 instance that changes each time a new AMI id is\n\t\t// selected.\n\t\tserverPet, err := random.NewPet(ctx, \"serverPet\", \u0026random.PetArgs{\n\t\t\tKeepers: pulumi.StringMap{\n\t\t\t\t\"ami_id\": pulumi.Any(_var.Ami_id),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = ec2.NewInstance(ctx, \"serverInstance\", \u0026ec2.InstanceArgs{\n\t\t\tTags: pulumi.StringMap{\n\t\t\t\t\"Name\": serverPet.ID().ApplyT(func(id string) (string, error) {\n\t\t\t\t\treturn fmt.Sprintf(\"web-server-%v\", id), nil\n\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t},\n\t\t\tAmi: pulumi.String(serverPet.Keepers.ApplyT(func(keepers map[string]string) (*string, error) {\n\t\t\t\treturn \u0026keepers.AmiId, nil\n\t\t\t}).(pulumi.StringPtrOutput)),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Pet;\nimport com.pulumi.random.PetArgs;\nimport com.pulumi.aws.ec2.Instance;\nimport com.pulumi.aws.ec2.InstanceArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n // The following example shows how to generate a unique pet name\n // for an AWS EC2 instance that changes each time a new AMI id is\n // selected.\n var serverPet = new Pet(\"serverPet\", PetArgs.builder()\n .keepers(Map.of(\"ami_id\", var_.ami_id()))\n .build());\n\n var serverInstance = new Instance(\"serverInstance\", InstanceArgs.builder()\n .tags(Map.of(\"Name\", serverPet.id().applyValue(id -\u003e String.format(\"web-server-%s\", id))))\n .ami(serverPet.keepers().applyValue(keepers -\u003e keepers.amiId()))\n .build());\n\n // ... (other aws_instance arguments) ...\n }\n}\n```\n```yaml\nresources:\n # The following example shows how to generate a unique pet name\n # for an AWS EC2 instance that changes each time a new AMI id is\n # selected.\n serverPet:\n type: random:Pet\n properties:\n keepers:\n ami_id: ${var.ami_id}\n serverInstance:\n type: aws:ec2:Instance\n properties:\n tags:\n Name: web-server-${serverPet.id}\n # Read the AMI id \"through\" the random_pet resource to ensure that\n # # both will change together.\n ami: ${serverPet.keepers.amiId}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n", "properties": { "keepers": { "type": "object", @@ -590,7 +590,7 @@ } }, "random:index/shuffle:Shuffle": { - "description": "The resource `random.Shuffle` generates a random permutation of a list of strings given as an argument.\n\n## Example Usage\n\n```terraform\nresource \"random_shuffle\" \"az\" {\n input = [\"us-west-1a\", \"us-west-1c\", \"us-west-1d\", \"us-west-1e\"]\n result_count = 2\n}\n\nresource \"aws_elb\" \"example\" {\n # Place the ELB in any two of the given availability zones, selected\n # at random.\n availability_zones = random_shuffle.az.result\n\n # ... and other aws_elb arguments ...\n}\n```\n", + "description": "The resource `random.Shuffle` generates a random permutation of a list of strings given as an argument.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as random from \"@pulumi/random\";\n\nconst az = new random.Shuffle(\"az\", {\n inputs: [\n \"us-west-1a\",\n \"us-west-1c\",\n \"us-west-1d\",\n \"us-west-1e\",\n ],\n resultCount: 2,\n});\nconst example = new aws.elb.LoadBalancer(\"example\", {availabilityZones: az.results});\n// ... and other aws_elb arguments ...\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\nimport pulumi_random as random\n\naz = random.Shuffle(\"az\",\n inputs=[\n \"us-west-1a\",\n \"us-west-1c\",\n \"us-west-1d\",\n \"us-west-1e\",\n ],\n result_count=2)\nexample = aws.elb.LoadBalancer(\"example\", availability_zones=az.results)\n# ... and other aws_elb arguments ...\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var az = new Random.Shuffle(\"az\", new()\n {\n Inputs = new[]\n {\n \"us-west-1a\",\n \"us-west-1c\",\n \"us-west-1d\",\n \"us-west-1e\",\n },\n ResultCount = 2,\n });\n\n var example = new Aws.Elb.LoadBalancer(\"example\", new()\n {\n AvailabilityZones = az.Results,\n });\n\n // ... and other aws_elb arguments ...\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elb\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\taz, err := random.NewShuffle(ctx, \"az\", \u0026random.ShuffleArgs{\n\t\t\tInputs: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"us-west-1a\"),\n\t\t\t\tpulumi.String(\"us-west-1c\"),\n\t\t\t\tpulumi.String(\"us-west-1d\"),\n\t\t\t\tpulumi.String(\"us-west-1e\"),\n\t\t\t},\n\t\t\tResultCount: pulumi.Float64(2),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = elb.NewLoadBalancer(ctx, \"example\", \u0026elb.LoadBalancerArgs{\n\t\t\tAvailabilityZones: az.Results,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Shuffle;\nimport com.pulumi.random.ShuffleArgs;\nimport com.pulumi.aws.elb.LoadBalancer;\nimport com.pulumi.aws.elb.LoadBalancerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var az = new Shuffle(\"az\", ShuffleArgs.builder()\n .inputs( \n \"us-west-1a\",\n \"us-west-1c\",\n \"us-west-1d\",\n \"us-west-1e\")\n .resultCount(2)\n .build());\n\n var example = new LoadBalancer(\"example\", LoadBalancerArgs.builder()\n .availabilityZones(az.results())\n .build());\n\n // ... and other aws_elb arguments ...\n }\n}\n```\n```yaml\nresources:\n az:\n type: random:Shuffle\n properties:\n inputs:\n - us-west-1a\n - us-west-1c\n - us-west-1d\n - us-west-1e\n resultCount: 2\n example:\n type: aws:elb:LoadBalancer\n properties:\n # Place the ELB in any two of the given availability zones, selected\n # # at random.\n availabilityZones: ${az.results}\n```\n\u003c!--End PulumiCodeChooser --\u003e\n", "properties": { "inputs": { "type": "array", @@ -690,7 +690,7 @@ } }, "random:index/string:String": { - "description": "The resource `random.String` generates a random permutation of alphanumeric characters and optionally special characters.\n\nThis resource *does* use a cryptographic random number generator.\n\nHistorically this resource's intended usage has been ambiguous as the original example used it in a password. For backwards compatibility it will continue to exist. For unique ids please use random_id, for sensitive random values please use random_password.\n\n## Example Usage\n\n```terraform\nresource \"random_string\" \"random\" {\n length = 16\n special = true\n override_special = \"/@£$\"\n}\n```\n\n## Import\n\n### Avoiding Replacement\n\n```sh\n$ pulumi import random:index/string:String If the resource were imported using `random_string.test test`,\n```\n\nreplacement can be avoided by using:\n\n1. Attribute values that match the imported ID and defaults:\n\n terraform\n\n resource \"random_string\" \"test\" {\n\n length = 4\n\n lower = true\n\n }\n\n2. Attribute values that match the imported ID and omit the attributes with defaults:\n\n terraform\n\n resource \"random_string\" \"test\" {\n\n length = 4\n\n }\n\n3. `ignore_changes` specifying the attributes to ignore:\n\n terraform\n\n resource \"random_string\" \"test\" {\n\n length = 16\n\n lower = false\n\n lifecycle {\n\n ignore_changes = [\n\n length,\n\n lower,\n\n ]\n\n }\n\n }\n\n **NOTE** `ignore_changes` is only required until the resource is recreated after import,\n\n after which it will use the configuration values specified.\n\n", + "description": "The resource `random.String` generates a random permutation of alphanumeric characters and optionally special characters.\n\nThis resource *does* use a cryptographic random number generator.\n\nHistorically this resource's intended usage has been ambiguous as the original example used it in a password. For backwards compatibility it will continue to exist. For unique ids please use random_id, for sensitive random values please use random_password.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as random from \"@pulumi/random\";\n\nconst random = new random.String(\"random\", {\n length: 16,\n overrideSpecial: \"/@£$\",\n special: true,\n});\n```\n```python\nimport pulumi\nimport pulumi_random as random\n\nrandom = random.String(\"random\",\n length=16,\n override_special=\"/@£$\",\n special=True)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var random = new Random.String(\"random\", new()\n {\n Length = 16,\n OverrideSpecial = \"/@£$\",\n Special = true,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := random.NewString(ctx, \"random\", \u0026random.StringArgs{\n\t\t\tLength: pulumi.Float64(16),\n\t\t\tOverrideSpecial: pulumi.String(\"/@£$\"),\n\t\t\tSpecial: pulumi.Bool(true),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.String;\nimport com.pulumi.random.StringArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var random = new String(\"random\", StringArgs.builder()\n .length(16)\n .overrideSpecial(\"/@£$\")\n .special(true)\n .build());\n\n }\n}\n```\n```yaml\nresources:\n random:\n type: random:String\n properties:\n length: 16\n overrideSpecial: /@£$\n special: true\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## Import\n\n### Avoiding Replacement\n\n```sh\n$ pulumi import random:index/string:String If the resource were imported using `random_string.test test`,\n```\n\nreplacement can be avoided by using:\n\n1. Attribute values that match the imported ID and defaults:\n\n terraform\n\n resource \"random_string\" \"test\" {\n\n length = 4\n\n lower = true\n\n }\n\n2. Attribute values that match the imported ID and omit the attributes with defaults:\n\n terraform\n\n resource \"random_string\" \"test\" {\n\n length = 4\n\n }\n\n3. `ignore_changes` specifying the attributes to ignore:\n\n terraform\n\n resource \"random_string\" \"test\" {\n\n length = 16\n\n lower = false\n\n lifecycle {\n\n ignore_changes = [\n\n length,\n\n lower,\n\n ]\n\n }\n\n }\n\n **NOTE** `ignore_changes` is only required until the resource is recreated after import,\n\n after which it will use the configuration values specified.\n\n", "properties": { "keepers": { "type": "object", @@ -883,7 +883,7 @@ } }, "random:index/uuid:Uuid": { - "description": "## Example Usage\n\n```terraform\n# The following example shows how to generate a unique name for an Azure Resource Group.\n\nresource \"random_uuid\" \"test\" {\n}\n\nresource \"azurerm_resource_group\" \"test\" {\n name = \"${random_uuid.test.result}-rg\"\n location = \"Central US\"\n}\n```\n\n## Import\n\nRandom UUID's can be imported. This can be used to replace a config\n\nvalue with a value interpolated from the random provider without\n\nexperiencing diffs.\n\n```sh\n$ pulumi import random:index/uuid:Uuid main aabbccdd-eeff-0011-2233-445566778899\n```\n\n", + "description": "## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as azurerm from \"@pulumi/azurerm\";\nimport * as random from \"@pulumi/random\";\n\n// The following example shows how to generate a unique name for an Azure Resource Group.\nconst testUuid = new random.Uuid(\"testUuid\", {});\nconst testazurerm_resource_group = new azurerm.index.Azurerm_resource_group(\"testazurerm_resource_group\", {\n name: `${testUuid.result}-rg`,\n location: \"Central US\",\n});\n```\n```python\nimport pulumi\nimport pulumi_azurerm as azurerm\nimport pulumi_random as random\n\n# The following example shows how to generate a unique name for an Azure Resource Group.\ntest_uuid = random.Uuid(\"testUuid\")\ntestazurerm_resource_group = azurerm.index.Azurerm_resource_group(\"testazurerm_resource_group\",\n name=f{test_uuid.result}-rg,\n location=Central US)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Azurerm = Pulumi.Azurerm;\nusing Random = Pulumi.Random;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n // The following example shows how to generate a unique name for an Azure Resource Group.\n var testUuid = new Random.Uuid(\"testUuid\");\n\n var testazurerm_resource_group = new Azurerm.Index.Azurerm_resource_group(\"testazurerm_resource_group\", new()\n {\n Name = $\"{testUuid.Result}-rg\",\n Location = \"Central US\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-azurerm/sdk/go/azurerm\"\n\trandom \"github.com/pulumi/pulumi-terraform-provider/sdks/go/random/v3\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t// The following example shows how to generate a unique name for an Azure Resource Group.\n\t\ttestUuid, err := random.NewUuid(ctx, \"testUuid\", nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = azurerm.NewAzurerm_resource_group(ctx, \"testazurerm_resource_group\", \u0026azurerm.Azurerm_resource_groupArgs{\n\t\t\tName: pulumi.Sprintf(\"%v-rg\", testUuid.Result),\n\t\t\tLocation: \"Central US\",\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.random.Uuid;\nimport com.pulumi.azurerm.azurerm_resource_group;\nimport com.pulumi.azurerm.Azurerm_resource_groupArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n // The following example shows how to generate a unique name for an Azure Resource Group.\n var testUuid = new Uuid(\"testUuid\");\n\n var testazurerm_resource_group = new Azurerm_resource_group(\"testazurerm_resource_group\", Azurerm_resource_groupArgs.builder()\n .name(String.format(\"%s-rg\", testUuid.result()))\n .location(\"Central US\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n # The following example shows how to generate a unique name for an Azure Resource Group.\n testUuid:\n type: random:Uuid\n testazurerm_resource_group:\n type: azurerm:azurerm_resource_group\n properties:\n name: ${testUuid.result}-rg\n location: Central US\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## Import\n\nRandom UUID's can be imported. This can be used to replace a config\n\nvalue with a value interpolated from the random provider without\n\nexperiencing diffs.\n\n```sh\n$ pulumi import random:index/uuid:Uuid main aabbccdd-eeff-0011-2233-445566778899\n```\n\n", "properties": { "keepers": { "type": "object", diff --git a/internal/testprovider_sdkv2/cmd/pulumi-resource-tpsdkv2/schema.json b/internal/testprovider_sdkv2/cmd/pulumi-resource-tpsdkv2/schema.json index 40a76cabf7..a2325fbc08 100644 --- a/internal/testprovider_sdkv2/cmd/pulumi-resource-tpsdkv2/schema.json +++ b/internal/testprovider_sdkv2/cmd/pulumi-resource-tpsdkv2/schema.json @@ -6,12 +6,12 @@ }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-tpsdkv2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-tpsdkv2` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-tpsdkv2` repo](https://github.com/terraform-providers/terraform-provider-tpsdkv2/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-tpsdkv2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-tpsdkv2` repo](https://github.com/terraform-providers/terraform-provider-tpsdkv2/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-tpsdkv2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-tpsdkv2` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-tpsdkv2` repo](https://github.com/terraform-providers/terraform-provider-tpsdkv2/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-tpsdkv2)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-tpsdkv2` repo](https://github.com/terraform-providers/terraform-provider-tpsdkv2/issues).", "compatibility": "tfbridge20", "pyproject": {} } diff --git a/pkg/tf2pulumi/convert/testdata/schemas/blocks.json b/pkg/tf2pulumi/convert/testdata/schemas/blocks.json index 12f40109f7..7f7ebdb1b9 100644 --- a/pkg/tf2pulumi/convert/testdata/schemas/blocks.json +++ b/pkg/tf2pulumi/convert/testdata/schemas/blocks.json @@ -1,17 +1,18 @@ { "name": "blocks", "attribution": "This Pulumi package is based on the [`blocks` Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks).", + "repository": "https://github.com/pulumi/pulumi-blocks", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-blocks` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-blocks` repo](https://github.com/terraform-providers/terraform-provider-blocks/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-blocks` repo](https://github.com/pulumi/pulumi-blocks/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-blocks` repo](https://github.com/terraform-providers/terraform-provider-blocks/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-blocks` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-blocks` repo](https://github.com/terraform-providers/terraform-provider-blocks/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-blocks` repo](https://github.com/pulumi/pulumi-blocks/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-blocks` repo](https://github.com/terraform-providers/terraform-provider-blocks/issues).", "compatibility": "tfbridge20", "pyproject": {} } diff --git a/pkg/tf2pulumi/convert/testdata/schemas/complex.json b/pkg/tf2pulumi/convert/testdata/schemas/complex.json index 7a1996854c..5c5adaf332 100644 --- a/pkg/tf2pulumi/convert/testdata/schemas/complex.json +++ b/pkg/tf2pulumi/convert/testdata/schemas/complex.json @@ -1,17 +1,18 @@ { "name": "complex", "attribution": "This Pulumi package is based on the [`complex` Terraform Provider](https://github.com/terraform-providers/terraform-provider-complex).", + "repository": "https://github.com/pulumi/pulumi-complex", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-complex)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-complex` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-complex` repo](https://github.com/terraform-providers/terraform-provider-complex/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-complex)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-complex` repo](https://github.com/pulumi/pulumi-complex/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-complex` repo](https://github.com/terraform-providers/terraform-provider-complex/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-complex)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-complex` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-complex` repo](https://github.com/terraform-providers/terraform-provider-complex/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-complex)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-complex` repo](https://github.com/pulumi/pulumi-complex/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-complex` repo](https://github.com/terraform-providers/terraform-provider-complex/issues).", "compatibility": "tfbridge20", "pyproject": {} } diff --git a/pkg/tf2pulumi/convert/testdata/schemas/renames.json b/pkg/tf2pulumi/convert/testdata/schemas/renames.json index d600f0ae26..679fcd24b0 100644 --- a/pkg/tf2pulumi/convert/testdata/schemas/renames.json +++ b/pkg/tf2pulumi/convert/testdata/schemas/renames.json @@ -1,17 +1,18 @@ { "name": "renames", "attribution": "This Pulumi package is based on the [`renames` Terraform Provider](https://github.com/terraform-providers/terraform-provider-renames).", + "repository": "https://github.com/pulumi/pulumi-renames", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-renames)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-renames` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-renames` repo](https://github.com/terraform-providers/terraform-provider-renames/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-renames)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-renames` repo](https://github.com/pulumi/pulumi-renames/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-renames` repo](https://github.com/terraform-providers/terraform-provider-renames/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-renames)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-renames` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-renames` repo](https://github.com/terraform-providers/terraform-provider-renames/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-renames)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-renames` repo](https://github.com/pulumi/pulumi-renames/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-renames` repo](https://github.com/terraform-providers/terraform-provider-renames/issues).", "compatibility": "tfbridge20", "pyproject": {} } diff --git a/pkg/tf2pulumi/convert/testdata/schemas/simple.json b/pkg/tf2pulumi/convert/testdata/schemas/simple.json index 1b3a13fde6..bda221e9c9 100644 --- a/pkg/tf2pulumi/convert/testdata/schemas/simple.json +++ b/pkg/tf2pulumi/convert/testdata/schemas/simple.json @@ -1,17 +1,18 @@ { "name": "simple", "attribution": "This Pulumi package is based on the [`simple` Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple).", + "repository": "https://github.com/pulumi/pulumi-simple", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-simple` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-simple` repo](https://github.com/pulumi/pulumi-simple/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-simple` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-simple` repo](https://github.com/pulumi/pulumi-simple/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", "compatibility": "tfbridge20", "pyproject": {} } diff --git a/pkg/tfgen/generate.go b/pkg/tfgen/generate.go index 24af79dbb9..09cf83bd21 100644 --- a/pkg/tfgen/generate.go +++ b/pkg/tfgen/generate.go @@ -886,22 +886,21 @@ func NewGenerator(opts GeneratorOptions) (*Generator, error) { } return &Generator{ - pkg: pkg, - version: version, - language: lang, - info: info, - root: root, - providerShim: providerShim, - pluginHost: newCachingProviderHost(host), - packageCache: pcl.NewPackageCache(), - infoSource: host, - terraformVersion: opts.TerraformVersion, - sink: sink, - skipDocs: opts.SkipDocs, - skipExamples: opts.SkipExamples, - coverageTracker: opts.CoverageTracker, - editRules: getEditRules(info.DocRules), - noDocsRepo: opts.XInMemoryDocs, + pkg: pkg, + version: version, + language: lang, + info: info, + root: root, + providerShim: providerShim, + pluginHost: newCachingProviderHost(host), + packageCache: pcl.NewPackageCache(), + infoSource: host, + sink: sink, + skipDocs: opts.SkipDocs, + skipExamples: opts.SkipExamples, + coverageTracker: opts.CoverageTracker, + editRules: getEditRules(info.DocRules), + noDocsRepo: opts.XInMemoryDocs, }, nil } diff --git a/pkg/tfgen/generate_schema.go b/pkg/tfgen/generate_schema.go index cfcf52c1d6..13f2a94fe1 100644 --- a/pkg/tfgen/generate_schema.go +++ b/pkg/tfgen/generate_schema.go @@ -587,16 +587,27 @@ func nodeLanguageExtensions(providerInfo *tfbridge.ProviderInfo, readme string) func getDefaultReadme(pulumiPackageName tokens.Package, tfProviderShortName string, tfGitHubOrg string, pulumiProvLicense tfbridge.TFProviderLicense, pulumiProvLicenseURI string, githubHost string, - pulumiProvRepo string, + sourceRepo string, ) string { //nolint:lll standardDocReadme := `> This provider is a derived work of the [Terraform Provider](https://%[6]s/%[3]s/terraform-provider-%[2]s) > distributed under [%[4]s](%[5]s). If you encounter a bug or missing feature, > first check the [` + "`pulumi-%[1]s`" + ` repo](%[7]s/issues); however, if that doesn't turn up anything, > please consult the source [` + "`terraform-provider-%[2]s`" + ` repo](https://%[6]s/%[3]s/terraform-provider-%[2]s/issues).` + //nolint:lll + dynamicDocReadme := `> This provider is a derived work of the [Terraform Provider](https://%[6]s/%[3]s/terraform-provider-%[2]s) +> distributed under [%[4]s](%[5]s). If you encounter a bug or missing feature, +> please consult the source [` + "`terraform-provider-%[2]s`" + ` repo](https://%[6]s/%[3]s/terraform-provider-%[2]s/issues).` + + var returnReadme string + if strings.Contains(sourceRepo, "pulumi") { + returnReadme = standardDocReadme + } else { + returnReadme = dynamicDocReadme + } - return fmt.Sprintf(standardDocReadme, pulumiPackageName, tfProviderShortName, tfGitHubOrg, pulumiProvLicense, - pulumiProvLicenseURI, githubHost, pulumiProvRepo) + return fmt.Sprintf(returnReadme, pulumiPackageName, tfProviderShortName, tfGitHubOrg, pulumiProvLicense, + pulumiProvLicenseURI, githubHost, sourceRepo) } func (g *schemaGenerator) genDocComment(comment string) string { diff --git a/pkg/tfgen/generate_schema_test.go b/pkg/tfgen/generate_schema_test.go index 9ce5670fa9..18b06938e7 100644 --- a/pkg/tfgen/generate_schema_test.go +++ b/pkg/tfgen/generate_schema_test.go @@ -222,6 +222,7 @@ func TestTypeSharing(t *testing.T) { }, }), UpstreamRepoPath: tmpdir, + Repository: "https://github.com/pulumi/pulumi-testprov", Resources: map[string]*info.Resource{ "testprov_r1": { Tok: "testprov:index:R1", diff --git a/pkg/tfgen/generate_test.go b/pkg/tfgen/generate_test.go index 0595dd6e8e..84c1bf2785 100644 --- a/pkg/tfgen/generate_test.go +++ b/pkg/tfgen/generate_test.go @@ -136,6 +136,7 @@ func Test_GenerateTestDataSchemas(t *testing.T) { pkg := strings.Replace(info.Name(), filepath.Ext(info.Name()), "", -1) provInfo, err := providerInfoSource.GetProviderInfo("", "", pkg, "") require.NoError(t, err) + provInfo.Repository = "https://github.com/pulumi/pulumi-" + pkg schema, err := GenerateSchema(*provInfo, nilSink) require.NoError(t, err) diff --git a/pkg/tfgen/test_data/TestConvertViaPulumiCLI/schema.json b/pkg/tfgen/test_data/TestConvertViaPulumiCLI/schema.json index 90244c7194..b224b949bc 100644 --- a/pkg/tfgen/test_data/TestConvertViaPulumiCLI/schema.json +++ b/pkg/tfgen/test_data/TestConvertViaPulumiCLI/schema.json @@ -6,12 +6,12 @@ }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-simple` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-simple` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-simple)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-simple` repo](https://github.com/terraform-providers/terraform-provider-simple/issues).", "compatibility": "tfbridge20", "pyproject": {} } diff --git a/pkg/tfgen/testdata/TestTypeSharing.golden b/pkg/tfgen/testdata/TestTypeSharing.golden index a846f64e7d..727ff09aaa 100644 --- a/pkg/tfgen/testdata/TestTypeSharing.golden +++ b/pkg/tfgen/testdata/TestTypeSharing.golden @@ -1,17 +1,18 @@ { "name": "testprov", "attribution": "This Pulumi package is based on the [`testprov` Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprov).", + "repository": "https://github.com/pulumi/pulumi-testprov", "meta": { "moduleFormat": "(.*)(?:/[^/]*)" }, "language": { "nodejs": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprov)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-testprov` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-testprov` repo](https://github.com/terraform-providers/terraform-provider-testprov/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprov)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-testprov` repo](https://github.com/pulumi/pulumi-testprov/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-testprov` repo](https://github.com/terraform-providers/terraform-provider-testprov/issues).", "compatibility": "tfbridge20", "disableUnionOutputTypes": true }, "python": { - "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprov)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-testprov` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-testprov` repo](https://github.com/terraform-providers/terraform-provider-testprov/issues).", + "readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprov)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-testprov` repo](https://github.com/pulumi/pulumi-testprov/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-testprov` repo](https://github.com/terraform-providers/terraform-provider-testprov/issues).", "compatibility": "tfbridge20", "pyproject": {} }