From 370149b9bd5b39a4a3bb7afcb306184d8314ba41 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Tue, 16 Apr 2024 18:29:17 -0400 Subject: [PATCH 1/8] Edit .ci-mgmt.yaml --- .ci-mgmt.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.ci-mgmt.yaml b/.ci-mgmt.yaml index e49a3f0d..39456fd6 100644 --- a/.ci-mgmt.yaml +++ b/.ci-mgmt.yaml @@ -3,6 +3,10 @@ major-version: 5 makeTemplate: bridged generate-nightly-test-workflow: true plugins: + - name: terraform + version: "1.0.16" + kind: converter + - name: aws version: "4.26.0" providerDefaultBranch: main @@ -19,3 +23,4 @@ actions: - name: Run provider tests run: | cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt +pulumiConvert: 1 From 3e77a68cb624e6ac85f92a0c8ba4383e6b88e03d Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Tue, 16 Apr 2024 18:29:19 -0400 Subject: [PATCH 2/8] make ci-mgmt --- Makefile | 3 ++- scripts/upstream.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b3fb170d..3eeca6e4 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ VERSION := $(shell pulumictl get version) JAVA_GEN := pulumi-java-gen TESTPARALLELISM := 10 WORKING_DIR := $(shell pwd) -PULUMI_CONVERT := 0 +PULUMI_CONVERT := 1 development: install_plugins provider build_sdks install_sdks @@ -111,6 +111,7 @@ install_nodejs_sdk: install_plugins: export PULUMI_HOME := $(WORKING_DIR)/.pulumi install_plugins: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH) install_plugins: .pulumi/bin/pulumi + .pulumi/bin/pulumi plugin install converter terraform 1.0.16 .pulumi/bin/pulumi plugin install resource aws 4.26.0 lint_provider: provider diff --git a/scripts/upstream.sh b/scripts/upstream.sh index eddf7df1..7d35e3b6 100755 --- a/scripts/upstream.sh +++ b/scripts/upstream.sh @@ -176,7 +176,7 @@ end_rebase() { rm patches/*.patch cd upstream - git format-patch local -o ../patches --zero-commit --no-signature --no-stat + git format-patch local -o ../patches --zero-commit --no-signature --no-stat --no-numbered cd .. rm rebase-in-progress apply "$1" From aa2c760c20786e7bf46fb8a1273ae2371d11fa4a Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Tue, 16 Apr 2024 18:30:08 -0400 Subject: [PATCH 3/8] make tfgen --- provider/cmd/pulumi-resource-tls/schema.json | 64 ++++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/provider/cmd/pulumi-resource-tls/schema.json b/provider/cmd/pulumi-resource-tls/schema.json index 0fe752ff..f51a8726 100644 --- a/provider/cmd/pulumi-resource-tls/schema.json +++ b/provider/cmd/pulumi-resource-tls/schema.json @@ -276,7 +276,7 @@ }, "resources": { "tls:index/certRequest:CertRequest": { - "description": "## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as fs from \"fs\";\nimport * as tls from \"@pulumi/tls\";\n\nconst example = new tls.CertRequest(\"example\", {\n privateKeyPem: fs.readFileSync(\"private_key.pem\", \"utf8\"),\n subject: {\n commonName: \"example.com\",\n organization: \"ACME Examples, Inc\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_tls as tls\n\nexample = tls.CertRequest(\"example\",\n private_key_pem=(lambda path: open(path).read())(\"private_key.pem\"),\n subject=tls.CertRequestSubjectArgs(\n common_name=\"example.com\",\n organization=\"ACME Examples, Inc\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing Pulumi;\nusing Tls = Pulumi.Tls;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Tls.CertRequest(\"example\", new()\n {\n PrivateKeyPem = File.ReadAllText(\"private_key.pem\"),\n Subject = new Tls.Inputs.CertRequestSubjectArgs\n {\n CommonName = \"example.com\",\n Organization = \"ACME Examples, Inc\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/pulumi/pulumi-tls/sdk/v5/go/tls\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc readFileOrPanic(path string) pulumi.StringPtrInput {\n\tdata, err := os.ReadFile(path)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn pulumi.String(string(data))\n}\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := tls.NewCertRequest(ctx, \"example\", \u0026tls.CertRequestArgs{\n\t\t\tPrivateKeyPem: readFileOrPanic(\"private_key.pem\"),\n\t\t\tSubject: \u0026tls.CertRequestSubjectArgs{\n\t\t\t\tCommonName: pulumi.String(\"example.com\"),\n\t\t\t\tOrganization: pulumi.String(\"ACME Examples, Inc\"),\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.tls.CertRequest;\nimport com.pulumi.tls.CertRequestArgs;\nimport com.pulumi.tls.inputs.CertRequestSubjectArgs;\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 example = new CertRequest(\"example\", CertRequestArgs.builder() \n .privateKeyPem(Files.readString(Paths.get(\"private_key.pem\")))\n .subject(CertRequestSubjectArgs.builder()\n .commonName(\"example.com\")\n .organization(\"ACME Examples, Inc\")\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: tls:CertRequest\n properties:\n privateKeyPem:\n fn::readFile: private_key.pem\n subject:\n commonName: example.com\n organization: ACME Examples, Inc\n```\n\u003c!--End PulumiCodeChooser --\u003e\n", + "description": "## Example Usage\n\n", "properties": { "certRequestPem": { "type": "string", @@ -976,38 +976,38 @@ "description": "A collection of values returned by getCertificate.\n", "properties": { "certificates": { - "type": "array", + "description": "The certificates protecting the site, with the root of the chain first.\n", "items": { "$ref": "#/types/tls:index/getCertificateCertificate:getCertificateCertificate" }, - "description": "The certificates protecting the site, with the root of the chain first.\n" + "type": "array" }, "content": { - "type": "string", - "description": "The content of the certificate in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. Cannot be used with `url`.\n" + "description": "The content of the certificate in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. Cannot be used with `url`.\n", + "type": "string" }, "id": { - "type": "string", - "description": "Unique identifier of this data source: hashing of the certificates in the chain.\n" + "description": "Unique identifier of this data source: hashing of the certificates in the chain.\n", + "type": "string" }, "url": { - "type": "string", - "description": "The URL of the website to get the certificates from. Cannot be used with `content`.\n" + "description": "The URL of the website to get the certificates from. Cannot be used with `content`.\n", + "type": "string" }, "verifyChain": { - "type": "boolean", - "description": "Whether to verify the certificate chain while parsing it or not (default: `true`). Cannot be used with `content`.\n" + "description": "Whether to verify the certificate chain while parsing it or not (default: `true`). Cannot be used with `content`.\n", + "type": "boolean" } }, - "type": "object", "required": [ "certificates", "id" - ] + ], + "type": "object" } }, "tls:index/getPublicKey:getPublicKey": { - "description": "Get a public key from a PEM-encoded private key.\n\nUse this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as fs from \"fs\";\nimport * as tls from \"@pulumi/tls\";\n\nconst ed25519_example = new tls.PrivateKey(\"ed25519-example\", {algorithm: \"ED25519\"});\nconst privateKeyPem-example = tls.getPublicKeyOutput({\n privateKeyPem: ed25519_example.privateKeyPem,\n});\nconst privateKeyOpenssh-example = tls.getPublicKey({\n privateKeyOpenssh: fs.readFileSync(\"~/.ssh/id_rsa_rfc4716\", \"utf8\"),\n});\n```\n```python\nimport pulumi\nimport pulumi_tls as tls\n\ned25519_example = tls.PrivateKey(\"ed25519-example\", algorithm=\"ED25519\")\nprivate_key_pem_example = tls.get_public_key_output(private_key_pem=ed25519_example.private_key_pem)\nprivate_key_openssh_example = tls.get_public_key(private_key_openssh=(lambda path: open(path).read())(\"~/.ssh/id_rsa_rfc4716\"))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing Pulumi;\nusing Tls = Pulumi.Tls;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var ed25519_example = new Tls.PrivateKey(\"ed25519-example\", new()\n {\n Algorithm = \"ED25519\",\n });\n\n var privateKeyPem_example = Tls.GetPublicKey.Invoke(new()\n {\n PrivateKeyPem = ed25519_example.PrivateKeyPem,\n });\n\n var privateKeyOpenssh_example = Tls.GetPublicKey.Invoke(new()\n {\n PrivateKeyOpenssh = File.ReadAllText(\"~/.ssh/id_rsa_rfc4716\"),\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/pulumi/pulumi-tls/sdk/v5/go/tls\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc readFileOrPanic(path string) pulumi.StringPtrInput {\n\tdata, err := os.ReadFile(path)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn pulumi.String(string(data))\n}\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := tls.NewPrivateKey(ctx, \"ed25519-example\", \u0026tls.PrivateKeyArgs{\n\t\t\tAlgorithm: pulumi.String(\"ED25519\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_ = tls.GetPublicKeyOutput(ctx, tls.GetPublicKeyOutputArgs{\n\t\t\tPrivateKeyPem: ed25519_example.PrivateKeyPem,\n\t\t}, nil)\n\t\t_, err = tls.GetPublicKey(ctx, \u0026tls.GetPublicKeyArgs{\n\t\t\tPrivateKeyOpenssh: pulumi.StringRef(readFileOrPanic(\"~/.ssh/id_rsa_rfc4716\")),\n\t\t}, nil)\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.tls.PrivateKey;\nimport com.pulumi.tls.PrivateKeyArgs;\nimport com.pulumi.tls.TlsFunctions;\nimport com.pulumi.tls.inputs.GetPublicKeyArgs;\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 ed25519_example = new PrivateKey(\"ed25519-example\", PrivateKeyArgs.builder() \n .algorithm(\"ED25519\")\n .build());\n\n final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder()\n .privateKeyPem(ed25519_example.privateKeyPem())\n .build());\n\n final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder()\n .privateKeyOpenssh(Files.readString(Paths.get(\"~/.ssh/id_rsa_rfc4716\")))\n .build());\n\n }\n}\n```\n```yaml\nresources:\n ed25519-example:\n type: tls:PrivateKey\n properties:\n algorithm: ED25519\nvariables:\n privateKeyPem-example:\n fn::invoke:\n Function: tls:getPublicKey\n Arguments:\n privateKeyPem: ${[\"ed25519-example\"].privateKeyPem}\n privateKeyOpenssh-example:\n fn::invoke:\n Function: tls:getPublicKey\n Arguments:\n privateKeyOpenssh:\n fn::readFile: ~/.ssh/id_rsa_rfc4716\n```\n\u003c!--End PulumiCodeChooser --\u003e\n", + "description": "Get a public key from a PEM-encoded private key.\n\nUse this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources.\n\n", "inputs": { "description": "A collection of arguments for invoking getPublicKey.\n", "properties": { @@ -1028,41 +1028,40 @@ "description": "A collection of values returned by getPublicKey.\n", "properties": { "algorithm": { - "type": "string", - "description": "The name of the algorithm used by the given private key. Possible values are: `RSA`, `ECDSA`, `ED25519`.\n" + "description": "The name of the algorithm used by the given private key. Possible values are: `RSA`, `ECDSA`, `ED25519`.\n", + "type": "string" }, "id": { - "type": "string", - "description": "Unique identifier for this data source: hexadecimal representation of the SHA1 checksum of the data source.\n" + "description": "Unique identifier for this data source: hexadecimal representation of the SHA1 checksum of the data source.\n", + "type": "string" }, "privateKeyOpenssh": { - "type": "string", "description": "The private key (in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format) to extract the public key from. This is *mutually exclusive* with `private_key_pem`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`.\n", - "secret": true + "secret": true, + "type": "string" }, "privateKeyPem": { - "type": "string", "description": "The private key (in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format) to extract the public key from. This is *mutually exclusive* with `private_key_openssh`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`.\n", - "secret": true + "secret": true, + "type": "string" }, "publicKeyFingerprintMd5": { - "type": "string", - "description": "The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. `aa:bb:cc:...`. Only available if the selected private key format is compatible, as per the rules for `public_key_openssh` and ECDSA P224 limitations.\n" + "description": "The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. `aa:bb:cc:...`. Only available if the selected private key format is compatible, as per the rules for `public_key_openssh` and ECDSA P224 limitations.\n", + "type": "string" }, "publicKeyFingerprintSha256": { - "type": "string", - "description": "The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g. `SHA256:...`. Only available if the selected private key format is compatible, as per the rules for `public_key_openssh` and ECDSA P224 limitations.\n" + "description": "The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g. `SHA256:...`. Only available if the selected private key format is compatible, as per the rules for `public_key_openssh` and ECDSA P224 limitations.\n", + "type": "string" }, "publicKeyOpenssh": { - "type": "string", - "description": "The public key, in OpenSSH PEM (RFC 4716).\n" + "description": "The public key, in OpenSSH PEM (RFC 4716).\n", + "type": "string" }, "publicKeyPem": { - "type": "string", - "description": "The public key, in PEM (RFC 1421).\n" + "description": "The public key, in PEM (RFC 1421).\n", + "type": "string" } }, - "type": "object", "required": [ "algorithm", "id", @@ -1070,7 +1069,8 @@ "publicKeyFingerprintSha256", "publicKeyOpenssh", "publicKeyPem" - ] + ], + "type": "object" } } } From 9fd38f065d500e2bb2e4eddfefd96ffde9106450 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Tue, 16 Apr 2024 18:30:44 -0400 Subject: [PATCH 4/8] make build_sdks --- sdk/dotnet/CertRequest.cs | 24 -- sdk/dotnet/GetPublicKey.cs | 62 ----- sdk/go/tls/certRequest.go | 40 --- sdk/go/tls/getPublicKey.go | 47 ---- .../main/java/com/pulumi/tls/CertRequest.java | 36 --- .../java/com/pulumi/tls/TlsFunctions.java | 258 ------------------ sdk/nodejs/certRequest.ts | 16 -- sdk/nodejs/getPublicKey.ts | 36 --- sdk/python/pulumi_tls/cert_request.py | 28 -- sdk/python/pulumi_tls/get_public_key.py | 26 -- 10 files changed, 573 deletions(-) diff --git a/sdk/dotnet/CertRequest.cs b/sdk/dotnet/CertRequest.cs index d00332ff..7e6c6e4b 100644 --- a/sdk/dotnet/CertRequest.cs +++ b/sdk/dotnet/CertRequest.cs @@ -11,30 +11,6 @@ namespace Pulumi.Tls { /// /// ## Example Usage - /// - /// <!--Start PulumiCodeChooser --> - /// ```csharp - /// using System.Collections.Generic; - /// using System.IO; - /// using System.Linq; - /// using Pulumi; - /// using Tls = Pulumi.Tls; - /// - /// return await Deployment.RunAsync(() => - /// { - /// var example = new Tls.CertRequest("example", new() - /// { - /// PrivateKeyPem = File.ReadAllText("private_key.pem"), - /// Subject = new Tls.Inputs.CertRequestSubjectArgs - /// { - /// CommonName = "example.com", - /// Organization = "ACME Examples, Inc", - /// }, - /// }); - /// - /// }); - /// ``` - /// <!--End PulumiCodeChooser --> /// [TlsResourceType("tls:index/certRequest:CertRequest")] public partial class CertRequest : global::Pulumi.CustomResource diff --git a/sdk/dotnet/GetPublicKey.cs b/sdk/dotnet/GetPublicKey.cs index 31aa60c8..b9538d97 100644 --- a/sdk/dotnet/GetPublicKey.cs +++ b/sdk/dotnet/GetPublicKey.cs @@ -15,37 +15,6 @@ public static class GetPublicKey /// Get a public key from a PEM-encoded private key. /// /// Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. - /// - /// ## Example Usage - /// - /// <!--Start PulumiCodeChooser --> - /// ```csharp - /// using System.Collections.Generic; - /// using System.IO; - /// using System.Linq; - /// using Pulumi; - /// using Tls = Pulumi.Tls; - /// - /// return await Deployment.RunAsync(() => - /// { - /// var ed25519_example = new Tls.PrivateKey("ed25519-example", new() - /// { - /// Algorithm = "ED25519", - /// }); - /// - /// var privateKeyPem_example = Tls.GetPublicKey.Invoke(new() - /// { - /// PrivateKeyPem = ed25519_example.PrivateKeyPem, - /// }); - /// - /// var privateKeyOpenssh_example = Tls.GetPublicKey.Invoke(new() - /// { - /// PrivateKeyOpenssh = File.ReadAllText("~/.ssh/id_rsa_rfc4716"), - /// }); - /// - /// }); - /// ``` - /// <!--End PulumiCodeChooser --> /// public static Task InvokeAsync(GetPublicKeyArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("tls:index/getPublicKey:getPublicKey", args ?? new GetPublicKeyArgs(), options.WithDefaults()); @@ -54,37 +23,6 @@ public static Task InvokeAsync(GetPublicKeyArgs? args = null /// Get a public key from a PEM-encoded private key. /// /// Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. - /// - /// ## Example Usage - /// - /// <!--Start PulumiCodeChooser --> - /// ```csharp - /// using System.Collections.Generic; - /// using System.IO; - /// using System.Linq; - /// using Pulumi; - /// using Tls = Pulumi.Tls; - /// - /// return await Deployment.RunAsync(() => - /// { - /// var ed25519_example = new Tls.PrivateKey("ed25519-example", new() - /// { - /// Algorithm = "ED25519", - /// }); - /// - /// var privateKeyPem_example = Tls.GetPublicKey.Invoke(new() - /// { - /// PrivateKeyPem = ed25519_example.PrivateKeyPem, - /// }); - /// - /// var privateKeyOpenssh_example = Tls.GetPublicKey.Invoke(new() - /// { - /// PrivateKeyOpenssh = File.ReadAllText("~/.ssh/id_rsa_rfc4716"), - /// }); - /// - /// }); - /// ``` - /// <!--End PulumiCodeChooser --> /// public static Output Invoke(GetPublicKeyInvokeArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("tls:index/getPublicKey:getPublicKey", args ?? new GetPublicKeyInvokeArgs(), options.WithDefaults()); diff --git a/sdk/go/tls/certRequest.go b/sdk/go/tls/certRequest.go index 2ca40d52..cffaf567 100644 --- a/sdk/go/tls/certRequest.go +++ b/sdk/go/tls/certRequest.go @@ -13,46 +13,6 @@ import ( ) // ## Example Usage -// -// -// ```go -// package main -// -// import ( -// -// "os" -// -// "github.com/pulumi/pulumi-tls/sdk/v5/go/tls" -// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -// -// ) -// -// func readFileOrPanic(path string) pulumi.StringPtrInput { -// data, err := os.ReadFile(path) -// if err != nil { -// panic(err.Error()) -// } -// return pulumi.String(string(data)) -// } -// -// func main() { -// pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := tls.NewCertRequest(ctx, "example", &tls.CertRequestArgs{ -// PrivateKeyPem: readFileOrPanic("private_key.pem"), -// Subject: &tls.CertRequestSubjectArgs{ -// CommonName: pulumi.String("example.com"), -// Organization: pulumi.String("ACME Examples, Inc"), -// }, -// }) -// if err != nil { -// return err -// } -// return nil -// }) -// } -// -// ``` -// type CertRequest struct { pulumi.CustomResourceState diff --git a/sdk/go/tls/getPublicKey.go b/sdk/go/tls/getPublicKey.go index da8b31c9..4d7dd17e 100644 --- a/sdk/go/tls/getPublicKey.go +++ b/sdk/go/tls/getPublicKey.go @@ -14,53 +14,6 @@ import ( // Get a public key from a PEM-encoded private key. // // Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. -// -// ## Example Usage -// -// -// ```go -// package main -// -// import ( -// -// "os" -// -// "github.com/pulumi/pulumi-tls/sdk/v5/go/tls" -// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -// -// ) -// -// func readFileOrPanic(path string) pulumi.StringPtrInput { -// data, err := os.ReadFile(path) -// if err != nil { -// panic(err.Error()) -// } -// return pulumi.String(string(data)) -// } -// -// func main() { -// pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := tls.NewPrivateKey(ctx, "ed25519-example", &tls.PrivateKeyArgs{ -// Algorithm: pulumi.String("ED25519"), -// }) -// if err != nil { -// return err -// } -// _ = tls.GetPublicKeyOutput(ctx, tls.GetPublicKeyOutputArgs{ -// PrivateKeyPem: ed25519_example.PrivateKeyPem, -// }, nil) -// _, err = tls.GetPublicKey(ctx, &tls.GetPublicKeyArgs{ -// PrivateKeyOpenssh: pulumi.StringRef(readFileOrPanic("~/.ssh/id_rsa_rfc4716")), -// }, nil) -// if err != nil { -// return err -// } -// return nil -// }) -// } -// -// ``` -// func GetPublicKey(ctx *pulumi.Context, args *GetPublicKeyArgs, opts ...pulumi.InvokeOption) (*GetPublicKeyResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetPublicKeyResult diff --git a/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java b/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java index 90f10950..484c9937 100644 --- a/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java +++ b/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java @@ -19,42 +19,6 @@ /** * ## Example Usage * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.CertRequest; - * import com.pulumi.tls.CertRequestArgs; - * import com.pulumi.tls.inputs.CertRequestSubjectArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var example = new CertRequest("example", CertRequestArgs.builder() - * .privateKeyPem(Files.readString(Paths.get("private_key.pem"))) - * .subject(CertRequestSubjectArgs.builder() - * .commonName("example.com") - * .organization("ACME Examples, Inc") - * .build()) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ @ResourceType(type="tls:index/certRequest:CertRequest") public class CertRequest extends com.pulumi.resources.CustomResource { diff --git a/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java b/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java index 04317a27..b6c9c27e 100644 --- a/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java +++ b/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java @@ -40,49 +40,6 @@ public static CompletableFuture getCertificatePlain(GetCer * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * - * ## Example Usage - * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.PrivateKey; - * import com.pulumi.tls.PrivateKeyArgs; - * import com.pulumi.tls.TlsFunctions; - * import com.pulumi.tls.inputs.GetPublicKeyArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() - * .algorithm("ED25519") - * .build()); - * - * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyPem(ed25519_example.privateKeyPem()) - * .build()); - * - * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyOpenssh(Files.readString(Paths.get("~/.ssh/id_rsa_rfc4716"))) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ public static Output getPublicKey() { return getPublicKey(GetPublicKeyArgs.Empty, InvokeOptions.Empty); @@ -92,49 +49,6 @@ public static Output getPublicKey() { * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * - * ## Example Usage - * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.PrivateKey; - * import com.pulumi.tls.PrivateKeyArgs; - * import com.pulumi.tls.TlsFunctions; - * import com.pulumi.tls.inputs.GetPublicKeyArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() - * .algorithm("ED25519") - * .build()); - * - * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyPem(ed25519_example.privateKeyPem()) - * .build()); - * - * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyOpenssh(Files.readString(Paths.get("~/.ssh/id_rsa_rfc4716"))) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ public static CompletableFuture getPublicKeyPlain() { return getPublicKeyPlain(GetPublicKeyPlainArgs.Empty, InvokeOptions.Empty); @@ -144,49 +58,6 @@ public static CompletableFuture getPublicKeyPlain() { * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * - * ## Example Usage - * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.PrivateKey; - * import com.pulumi.tls.PrivateKeyArgs; - * import com.pulumi.tls.TlsFunctions; - * import com.pulumi.tls.inputs.GetPublicKeyArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() - * .algorithm("ED25519") - * .build()); - * - * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyPem(ed25519_example.privateKeyPem()) - * .build()); - * - * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyOpenssh(Files.readString(Paths.get("~/.ssh/id_rsa_rfc4716"))) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ public static Output getPublicKey(GetPublicKeyArgs args) { return getPublicKey(args, InvokeOptions.Empty); @@ -196,49 +67,6 @@ public static Output getPublicKey(GetPublicKeyArgs args) { * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * - * ## Example Usage - * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.PrivateKey; - * import com.pulumi.tls.PrivateKeyArgs; - * import com.pulumi.tls.TlsFunctions; - * import com.pulumi.tls.inputs.GetPublicKeyArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() - * .algorithm("ED25519") - * .build()); - * - * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyPem(ed25519_example.privateKeyPem()) - * .build()); - * - * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyOpenssh(Files.readString(Paths.get("~/.ssh/id_rsa_rfc4716"))) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ public static CompletableFuture getPublicKeyPlain(GetPublicKeyPlainArgs args) { return getPublicKeyPlain(args, InvokeOptions.Empty); @@ -248,49 +76,6 @@ public static CompletableFuture getPublicKeyPlain(GetPublicK * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * - * ## Example Usage - * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.PrivateKey; - * import com.pulumi.tls.PrivateKeyArgs; - * import com.pulumi.tls.TlsFunctions; - * import com.pulumi.tls.inputs.GetPublicKeyArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() - * .algorithm("ED25519") - * .build()); - * - * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyPem(ed25519_example.privateKeyPem()) - * .build()); - * - * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyOpenssh(Files.readString(Paths.get("~/.ssh/id_rsa_rfc4716"))) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ public static Output getPublicKey(GetPublicKeyArgs args, InvokeOptions options) { return Deployment.getInstance().invoke("tls:index/getPublicKey:getPublicKey", TypeShape.of(GetPublicKeyResult.class), args, Utilities.withVersion(options)); @@ -300,49 +85,6 @@ public static Output getPublicKey(GetPublicKeyArgs args, Inv * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * - * ## Example Usage - * - * <!--Start PulumiCodeChooser --> - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.tls.PrivateKey; - * import com.pulumi.tls.PrivateKeyArgs; - * import com.pulumi.tls.TlsFunctions; - * import com.pulumi.tls.inputs.GetPublicKeyArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() - * .algorithm("ED25519") - * .build()); - * - * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyPem(ed25519_example.privateKeyPem()) - * .build()); - * - * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() - * .privateKeyOpenssh(Files.readString(Paths.get("~/.ssh/id_rsa_rfc4716"))) - * .build()); - * - * } - * } - * ``` - * <!--End PulumiCodeChooser --> - * */ public static CompletableFuture getPublicKeyPlain(GetPublicKeyPlainArgs args, InvokeOptions options) { return Deployment.getInstance().invokeAsync("tls:index/getPublicKey:getPublicKey", TypeShape.of(GetPublicKeyResult.class), args, Utilities.withVersion(options)); diff --git a/sdk/nodejs/certRequest.ts b/sdk/nodejs/certRequest.ts index ae84e11a..d3947f9b 100644 --- a/sdk/nodejs/certRequest.ts +++ b/sdk/nodejs/certRequest.ts @@ -8,22 +8,6 @@ import * as utilities from "./utilities"; /** * ## Example Usage - * - * - * ```typescript - * import * as pulumi from "@pulumi/pulumi"; - * import * as fs from "fs"; - * import * as tls from "@pulumi/tls"; - * - * const example = new tls.CertRequest("example", { - * privateKeyPem: fs.readFileSync("private_key.pem", "utf8"), - * subject: { - * commonName: "example.com", - * organization: "ACME Examples, Inc", - * }, - * }); - * ``` - * */ export class CertRequest extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/getPublicKey.ts b/sdk/nodejs/getPublicKey.ts index 2214111f..f36edcba 100644 --- a/sdk/nodejs/getPublicKey.ts +++ b/sdk/nodejs/getPublicKey.ts @@ -8,24 +8,6 @@ import * as utilities from "./utilities"; * Get a public key from a PEM-encoded private key. * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. - * - * ## Example Usage - * - * - * ```typescript - * import * as pulumi from "@pulumi/pulumi"; - * import * as fs from "fs"; - * import * as tls from "@pulumi/tls"; - * - * const ed25519_example = new tls.PrivateKey("ed25519-example", {algorithm: "ED25519"}); - * const privateKeyPem-example = tls.getPublicKeyOutput({ - * privateKeyPem: ed25519_example.privateKeyPem, - * }); - * const privateKeyOpenssh-example = tls.getPublicKey({ - * privateKeyOpenssh: fs.readFileSync("~/.ssh/id_rsa_rfc4716", "utf8"), - * }); - * ``` - * */ export function getPublicKey(args?: GetPublicKeyArgs, opts?: pulumi.InvokeOptions): Promise { args = args || {}; @@ -92,24 +74,6 @@ export interface GetPublicKeyResult { * Get a public key from a PEM-encoded private key. * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. - * - * ## Example Usage - * - * - * ```typescript - * import * as pulumi from "@pulumi/pulumi"; - * import * as fs from "fs"; - * import * as tls from "@pulumi/tls"; - * - * const ed25519_example = new tls.PrivateKey("ed25519-example", {algorithm: "ED25519"}); - * const privateKeyPem-example = tls.getPublicKeyOutput({ - * privateKeyPem: ed25519_example.privateKeyPem, - * }); - * const privateKeyOpenssh-example = tls.getPublicKey({ - * privateKeyOpenssh: fs.readFileSync("~/.ssh/id_rsa_rfc4716", "utf8"), - * }); - * ``` - * */ export function getPublicKeyOutput(args?: GetPublicKeyOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getPublicKey(a, opts)) diff --git a/sdk/python/pulumi_tls/cert_request.py b/sdk/python/pulumi_tls/cert_request.py index 58bdbf50..e3367748 100644 --- a/sdk/python/pulumi_tls/cert_request.py +++ b/sdk/python/pulumi_tls/cert_request.py @@ -234,20 +234,6 @@ def __init__(__self__, """ ## Example Usage - - ```python - import pulumi - import pulumi_tls as tls - - example = tls.CertRequest("example", - private_key_pem=(lambda path: open(path).read())("private_key.pem"), - subject=tls.CertRequestSubjectArgs( - common_name="example.com", - organization="ACME Examples, Inc", - )) - ``` - - :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Sequence[pulumi.Input[str]]] dns_names: List of DNS names for which a certificate is being requested (i.e. certificate subjects). @@ -265,20 +251,6 @@ def __init__(__self__, """ ## Example Usage - - ```python - import pulumi - import pulumi_tls as tls - - example = tls.CertRequest("example", - private_key_pem=(lambda path: open(path).read())("private_key.pem"), - subject=tls.CertRequestSubjectArgs( - common_name="example.com", - organization="ACME Examples, Inc", - )) - ``` - - :param str resource_name: The name of the resource. :param CertRequestArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_tls/get_public_key.py b/sdk/python/pulumi_tls/get_public_key.py index 430cb7a4..fbb37656 100644 --- a/sdk/python/pulumi_tls/get_public_key.py +++ b/sdk/python/pulumi_tls/get_public_key.py @@ -136,19 +136,6 @@ def get_public_key(private_key_openssh: Optional[str] = None, Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. - ## Example Usage - - - ```python - import pulumi - import pulumi_tls as tls - - ed25519_example = tls.PrivateKey("ed25519-example", algorithm="ED25519") - private_key_pem_example = tls.get_public_key_output(private_key_pem=ed25519_example.private_key_pem) - private_key_openssh_example = tls.get_public_key(private_key_openssh=(lambda path: open(path).read())("~/.ssh/id_rsa_rfc4716")) - ``` - - :param str private_key_openssh: The private key (in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format) to extract the public key from. This is *mutually exclusive* with `private_key_pem`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. :param str private_key_pem: The private key (in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format) to extract the public key from. This is *mutually exclusive* with `private_key_openssh`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. @@ -179,19 +166,6 @@ def get_public_key_output(private_key_openssh: Optional[pulumi.Input[Optional[st Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. - ## Example Usage - - - ```python - import pulumi - import pulumi_tls as tls - - ed25519_example = tls.PrivateKey("ed25519-example", algorithm="ED25519") - private_key_pem_example = tls.get_public_key_output(private_key_pem=ed25519_example.private_key_pem) - private_key_openssh_example = tls.get_public_key(private_key_openssh=(lambda path: open(path).read())("~/.ssh/id_rsa_rfc4716")) - ``` - - :param str private_key_openssh: The private key (in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format) to extract the public key from. This is *mutually exclusive* with `private_key_pem`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. :param str private_key_pem: The private key (in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format) to extract the public key from. This is *mutually exclusive* with `private_key_openssh`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. From a90ee7b249a4e96ad6b2ca10ab4782f5a5235b19 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Thu, 18 Apr 2024 14:13:51 -0400 Subject: [PATCH 5/8] Edit .ci-mgmt.yaml --- .ci-mgmt.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci-mgmt.yaml b/.ci-mgmt.yaml index 39456fd6..9368c179 100644 --- a/.ci-mgmt.yaml +++ b/.ci-mgmt.yaml @@ -3,6 +3,9 @@ major-version: 5 makeTemplate: bridged generate-nightly-test-workflow: true plugins: + - name: std + version: "1.6.2" + - name: terraform version: "1.0.16" kind: converter From 1ee6add8533d46c8658b427b37284f09a36f7f30 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Thu, 18 Apr 2024 14:13:52 -0400 Subject: [PATCH 6/8] make ci-mgmt --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3eeca6e4..81c8e201 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ install_nodejs_sdk: install_plugins: export PULUMI_HOME := $(WORKING_DIR)/.pulumi install_plugins: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH) install_plugins: .pulumi/bin/pulumi + .pulumi/bin/pulumi plugin install resource std 1.6.2 .pulumi/bin/pulumi plugin install converter terraform 1.0.16 .pulumi/bin/pulumi plugin install resource aws 4.26.0 From 70f3116da807af7116879370f5a077059ce94237 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Thu, 18 Apr 2024 14:14:04 -0400 Subject: [PATCH 7/8] make tfgen --- provider/cmd/pulumi-resource-tls/schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provider/cmd/pulumi-resource-tls/schema.json b/provider/cmd/pulumi-resource-tls/schema.json index f51a8726..be6b66c8 100644 --- a/provider/cmd/pulumi-resource-tls/schema.json +++ b/provider/cmd/pulumi-resource-tls/schema.json @@ -276,7 +276,7 @@ }, "resources": { "tls:index/certRequest:CertRequest": { - "description": "## Example Usage\n\n", + "description": "## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as std from \"@pulumi/std\";\nimport * as tls from \"@pulumi/tls\";\n\nconst example = new tls.CertRequest(\"example\", {\n privateKeyPem: std.file({\n input: \"private_key.pem\",\n }).then(invoke =\u003e invoke.result),\n subject: {\n commonName: \"example.com\",\n organization: \"ACME Examples, Inc\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_std as std\nimport pulumi_tls as tls\n\nexample = tls.CertRequest(\"example\",\n private_key_pem=std.file(input=\"private_key.pem\").result,\n subject=tls.CertRequestSubjectArgs(\n common_name=\"example.com\",\n organization=\"ACME Examples, Inc\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Std = Pulumi.Std;\nusing Tls = Pulumi.Tls;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Tls.CertRequest(\"example\", new()\n {\n PrivateKeyPem = Std.File.Invoke(new()\n {\n Input = \"private_key.pem\",\n }).Apply(invoke =\u003e invoke.Result),\n Subject = new Tls.Inputs.CertRequestSubjectArgs\n {\n CommonName = \"example.com\",\n Organization = \"ACME Examples, Inc\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-std/sdk/go/std\"\n\t\"github.com/pulumi/pulumi-tls/sdk/v5/go/tls\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\tinvokeFile, err := std.File(ctx, \u0026std.FileArgs{\n\t\t\tInput: \"private_key.pem\",\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = tls.NewCertRequest(ctx, \"example\", \u0026tls.CertRequestArgs{\n\t\t\tPrivateKeyPem: invokeFile.Result,\n\t\t\tSubject: \u0026tls.CertRequestSubjectArgs{\n\t\t\t\tCommonName: pulumi.String(\"example.com\"),\n\t\t\t\tOrganization: pulumi.String(\"ACME Examples, Inc\"),\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.tls.CertRequest;\nimport com.pulumi.tls.CertRequestArgs;\nimport com.pulumi.tls.inputs.CertRequestSubjectArgs;\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 example = new CertRequest(\"example\", CertRequestArgs.builder() \n .privateKeyPem(StdFunctions.file(FileArgs.builder()\n .input(\"private_key.pem\")\n .build()).result())\n .subject(CertRequestSubjectArgs.builder()\n .commonName(\"example.com\")\n .organization(\"ACME Examples, Inc\")\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: tls:CertRequest\n properties:\n privateKeyPem:\n fn::invoke:\n Function: std:file\n Arguments:\n input: private_key.pem\n Return: result\n subject:\n commonName: example.com\n organization: ACME Examples, Inc\n```\n\u003c!--End PulumiCodeChooser --\u003e\n", "properties": { "certRequestPem": { "type": "string", @@ -1007,7 +1007,7 @@ } }, "tls:index/getPublicKey:getPublicKey": { - "description": "Get a public key from a PEM-encoded private key.\n\nUse this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources.\n\n", + "description": "Get a public key from a PEM-encoded private key.\n\nUse this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as std from \"@pulumi/std\";\nimport * as tls from \"@pulumi/tls\";\n\nconst ed25519_example = new tls.PrivateKey(\"ed25519-example\", {algorithm: \"ED25519\"});\n// Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format\nconst privateKeyPem-example = tls.getPublicKeyOutput({\n privateKeyPem: ed25519_example.privateKeyPem,\n});\n// Public key loaded from filesystem, using the Open SSH (RFC 4716) format\nconst privateKeyOpenssh-example = std.file({\n input: \"~/.ssh/id_rsa_rfc4716\",\n}).then(invoke =\u003e tls.getPublicKey({\n privateKeyOpenssh: invoke.result,\n}));\n```\n```python\nimport pulumi\nimport pulumi_std as std\nimport pulumi_tls as tls\n\ned25519_example = tls.PrivateKey(\"ed25519-example\", algorithm=\"ED25519\")\n# Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format\nprivate_key_pem_example = tls.get_public_key_output(private_key_pem=ed25519_example.private_key_pem)\n# Public key loaded from filesystem, using the Open SSH (RFC 4716) format\nprivate_key_openssh_example = tls.get_public_key(private_key_openssh=std.file(input=\"~/.ssh/id_rsa_rfc4716\").result)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Std = Pulumi.Std;\nusing Tls = Pulumi.Tls;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var ed25519_example = new Tls.PrivateKey(\"ed25519-example\", new()\n {\n Algorithm = \"ED25519\",\n });\n\n // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format\n var privateKeyPem_example = Tls.GetPublicKey.Invoke(new()\n {\n PrivateKeyPem = ed25519_example.PrivateKeyPem,\n });\n\n // Public key loaded from filesystem, using the Open SSH (RFC 4716) format\n var privateKeyOpenssh_example = Tls.GetPublicKey.Invoke(new()\n {\n PrivateKeyOpenssh = Std.File.Invoke(new()\n {\n Input = \"~/.ssh/id_rsa_rfc4716\",\n }).Result,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-std/sdk/go/std\"\n\t\"github.com/pulumi/pulumi-tls/sdk/v5/go/tls\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\nfunc main() {\npulumi.Run(func(ctx *pulumi.Context) error {\n_, err := tls.NewPrivateKey(ctx, \"ed25519-example\", \u0026tls.PrivateKeyArgs{\nAlgorithm: pulumi.String(\"ED25519\"),\n})\nif err != nil {\nreturn err\n}\n// Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format\n_ = tls.GetPublicKeyOutput(ctx, tls.GetPublicKeyOutputArgs{\nPrivateKeyPem: ed25519_example.PrivateKeyPem,\n}, nil);\n// Public key loaded from filesystem, using the Open SSH (RFC 4716) format\n_, err = tls.GetPublicKey(ctx, invokeFile, err := std.File(ctx, \u0026std.FileArgs{\nInput: \"~/.ssh/id_rsa_rfc4716\",\n}, nil)\nif err != nil {\nreturn err\n}\n\u0026tls.GetPublicKeyArgs{\nPrivateKeyOpenssh: pulumi.StringRef(invokeFile.Result),\n}, nil);\nif err != nil {\nreturn err\n}\nreturn nil\n})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.tls.PrivateKey;\nimport com.pulumi.tls.PrivateKeyArgs;\nimport com.pulumi.tls.TlsFunctions;\nimport com.pulumi.tls.inputs.GetPublicKeyArgs;\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 ed25519_example = new PrivateKey(\"ed25519-example\", PrivateKeyArgs.builder() \n .algorithm(\"ED25519\")\n .build());\n\n // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format\n final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder()\n .privateKeyPem(ed25519_example.privateKeyPem())\n .build());\n\n // Public key loaded from filesystem, using the Open SSH (RFC 4716) format\n final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder()\n .privateKeyOpenssh(StdFunctions.file(FileArgs.builder()\n .input(\"~/.ssh/id_rsa_rfc4716\")\n .build()).result())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n ed25519-example:\n type: tls:PrivateKey\n properties:\n algorithm: ED25519\nvariables:\n # Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format\n privateKeyPem-example:\n fn::invoke:\n Function: tls:getPublicKey\n Arguments:\n privateKeyPem: ${[\"ed25519-example\"].privateKeyPem}\n # Public key loaded from filesystem, using the Open SSH (RFC 4716) format\n privateKeyOpenssh-example:\n fn::invoke:\n Function: tls:getPublicKey\n Arguments:\n privateKeyOpenssh:\n fn::invoke:\n Function: std:file\n Arguments:\n input: ~/.ssh/id_rsa_rfc4716\n Return: result\n```\n\u003c!--End PulumiCodeChooser --\u003e\n", "inputs": { "description": "A collection of arguments for invoking getPublicKey.\n", "properties": { From cc7f3fb34f970974154dd17a5065f25365b4d8e2 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Thu, 18 Apr 2024 14:14:44 -0400 Subject: [PATCH 8/8] make build_sdks --- sdk/dotnet/CertRequest.cs | 27 ++ sdk/dotnet/GetPublicKey.cs | 72 +++++ sdk/go/tls/certRequest.go | 37 +++ sdk/go/tls/getPublicKey.go | 44 +++ .../main/java/com/pulumi/tls/CertRequest.java | 38 +++ .../java/com/pulumi/tls/TlsFunctions.java | 282 ++++++++++++++++++ sdk/nodejs/certRequest.ts | 18 ++ sdk/nodejs/getPublicKey.ts | 44 +++ sdk/python/pulumi_tls/cert_request.py | 30 ++ sdk/python/pulumi_tls/get_public_key.py | 32 ++ 10 files changed, 624 insertions(+) diff --git a/sdk/dotnet/CertRequest.cs b/sdk/dotnet/CertRequest.cs index 7e6c6e4b..ca843bfe 100644 --- a/sdk/dotnet/CertRequest.cs +++ b/sdk/dotnet/CertRequest.cs @@ -11,6 +11,33 @@ namespace Pulumi.Tls { /// /// ## Example Usage + /// + /// <!--Start PulumiCodeChooser --> + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Std = Pulumi.Std; + /// using Tls = Pulumi.Tls; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Tls.CertRequest("example", new() + /// { + /// PrivateKeyPem = Std.File.Invoke(new() + /// { + /// Input = "private_key.pem", + /// }).Apply(invoke => invoke.Result), + /// Subject = new Tls.Inputs.CertRequestSubjectArgs + /// { + /// CommonName = "example.com", + /// Organization = "ACME Examples, Inc", + /// }, + /// }); + /// + /// }); + /// ``` + /// <!--End PulumiCodeChooser --> /// [TlsResourceType("tls:index/certRequest:CertRequest")] public partial class CertRequest : global::Pulumi.CustomResource diff --git a/sdk/dotnet/GetPublicKey.cs b/sdk/dotnet/GetPublicKey.cs index b9538d97..87b35bfa 100644 --- a/sdk/dotnet/GetPublicKey.cs +++ b/sdk/dotnet/GetPublicKey.cs @@ -15,6 +15,42 @@ public static class GetPublicKey /// Get a public key from a PEM-encoded private key. /// /// Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. + /// + /// ## Example Usage + /// + /// <!--Start PulumiCodeChooser --> + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Std = Pulumi.Std; + /// using Tls = Pulumi.Tls; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var ed25519_example = new Tls.PrivateKey("ed25519-example", new() + /// { + /// Algorithm = "ED25519", + /// }); + /// + /// // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + /// var privateKeyPem_example = Tls.GetPublicKey.Invoke(new() + /// { + /// PrivateKeyPem = ed25519_example.PrivateKeyPem, + /// }); + /// + /// // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + /// var privateKeyOpenssh_example = Tls.GetPublicKey.Invoke(new() + /// { + /// PrivateKeyOpenssh = Std.File.Invoke(new() + /// { + /// Input = "~/.ssh/id_rsa_rfc4716", + /// }).Result, + /// }); + /// + /// }); + /// ``` + /// <!--End PulumiCodeChooser --> /// public static Task InvokeAsync(GetPublicKeyArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.InvokeAsync("tls:index/getPublicKey:getPublicKey", args ?? new GetPublicKeyArgs(), options.WithDefaults()); @@ -23,6 +59,42 @@ public static Task InvokeAsync(GetPublicKeyArgs? args = null /// Get a public key from a PEM-encoded private key. /// /// Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. + /// + /// ## Example Usage + /// + /// <!--Start PulumiCodeChooser --> + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Std = Pulumi.Std; + /// using Tls = Pulumi.Tls; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var ed25519_example = new Tls.PrivateKey("ed25519-example", new() + /// { + /// Algorithm = "ED25519", + /// }); + /// + /// // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + /// var privateKeyPem_example = Tls.GetPublicKey.Invoke(new() + /// { + /// PrivateKeyPem = ed25519_example.PrivateKeyPem, + /// }); + /// + /// // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + /// var privateKeyOpenssh_example = Tls.GetPublicKey.Invoke(new() + /// { + /// PrivateKeyOpenssh = Std.File.Invoke(new() + /// { + /// Input = "~/.ssh/id_rsa_rfc4716", + /// }).Result, + /// }); + /// + /// }); + /// ``` + /// <!--End PulumiCodeChooser --> /// public static Output Invoke(GetPublicKeyInvokeArgs? args = null, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("tls:index/getPublicKey:getPublicKey", args ?? new GetPublicKeyInvokeArgs(), options.WithDefaults()); diff --git a/sdk/go/tls/certRequest.go b/sdk/go/tls/certRequest.go index cffaf567..6e571c9d 100644 --- a/sdk/go/tls/certRequest.go +++ b/sdk/go/tls/certRequest.go @@ -13,6 +13,43 @@ import ( ) // ## Example Usage +// +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-std/sdk/go/std" +// "github.com/pulumi/pulumi-tls/sdk/v5/go/tls" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// invokeFile, err := std.File(ctx, &std.FileArgs{ +// Input: "private_key.pem", +// }, nil) +// if err != nil { +// return err +// } +// _, err = tls.NewCertRequest(ctx, "example", &tls.CertRequestArgs{ +// PrivateKeyPem: invokeFile.Result, +// Subject: &tls.CertRequestSubjectArgs{ +// CommonName: pulumi.String("example.com"), +// Organization: pulumi.String("ACME Examples, Inc"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// type CertRequest struct { pulumi.CustomResourceState diff --git a/sdk/go/tls/getPublicKey.go b/sdk/go/tls/getPublicKey.go index 4d7dd17e..13fb00ab 100644 --- a/sdk/go/tls/getPublicKey.go +++ b/sdk/go/tls/getPublicKey.go @@ -14,6 +14,50 @@ import ( // Get a public key from a PEM-encoded private key. // // Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. +// +// ## Example Usage +// +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-std/sdk/go/std" +// "github.com/pulumi/pulumi-tls/sdk/v5/go/tls" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := tls.NewPrivateKey(ctx, "ed25519-example", &tls.PrivateKeyArgs{ +// Algorithm: pulumi.String("ED25519"), +// }) +// if err != nil { +// return err +// } +// // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format +// _ = tls.GetPublicKeyOutput(ctx, tls.GetPublicKeyOutputArgs{ +// PrivateKeyPem: ed25519_example.PrivateKeyPem, +// }, nil); +// // Public key loaded from filesystem, using the Open SSH (RFC 4716) format +// _, err = tls.GetPublicKey(ctx, invokeFile, err := std.File(ctx, &std.FileArgs{ +// Input: "~/.ssh/id_rsa_rfc4716", +// }, nil) +// if err != nil { +// return err +// } +// &tls.GetPublicKeyArgs{ +// PrivateKeyOpenssh: pulumi.StringRef(invokeFile.Result), +// }, nil); +// if err != nil { +// return err +// } +// return nil +// }) +// } +// ``` +// func GetPublicKey(ctx *pulumi.Context, args *GetPublicKeyArgs, opts ...pulumi.InvokeOption) (*GetPublicKeyResult, error) { opts = internal.PkgInvokeDefaultOpts(opts) var rv GetPublicKeyResult diff --git a/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java b/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java index 484c9937..f6be3f99 100644 --- a/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java +++ b/sdk/java/src/main/java/com/pulumi/tls/CertRequest.java @@ -19,6 +19,44 @@ /** * ## Example Usage * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.CertRequest; + * import com.pulumi.tls.CertRequestArgs; + * import com.pulumi.tls.inputs.CertRequestSubjectArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new CertRequest("example", CertRequestArgs.builder() + * .privateKeyPem(StdFunctions.file(FileArgs.builder() + * .input("private_key.pem") + * .build()).result()) + * .subject(CertRequestSubjectArgs.builder() + * .commonName("example.com") + * .organization("ACME Examples, Inc") + * .build()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ @ResourceType(type="tls:index/certRequest:CertRequest") public class CertRequest extends com.pulumi.resources.CustomResource { diff --git a/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java b/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java index b6c9c27e..54506611 100644 --- a/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java +++ b/sdk/java/src/main/java/com/pulumi/tls/TlsFunctions.java @@ -40,6 +40,53 @@ public static CompletableFuture getCertificatePlain(GetCer * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.PrivateKey; + * import com.pulumi.tls.PrivateKeyArgs; + * import com.pulumi.tls.TlsFunctions; + * import com.pulumi.tls.inputs.GetPublicKeyArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() + * .algorithm("ED25519") + * .build()); + * + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyPem(ed25519_example.privateKeyPem()) + * .build()); + * + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyOpenssh(StdFunctions.file(FileArgs.builder() + * .input("~/.ssh/id_rsa_rfc4716") + * .build()).result()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ public static Output getPublicKey() { return getPublicKey(GetPublicKeyArgs.Empty, InvokeOptions.Empty); @@ -49,6 +96,53 @@ public static Output getPublicKey() { * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.PrivateKey; + * import com.pulumi.tls.PrivateKeyArgs; + * import com.pulumi.tls.TlsFunctions; + * import com.pulumi.tls.inputs.GetPublicKeyArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() + * .algorithm("ED25519") + * .build()); + * + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyPem(ed25519_example.privateKeyPem()) + * .build()); + * + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyOpenssh(StdFunctions.file(FileArgs.builder() + * .input("~/.ssh/id_rsa_rfc4716") + * .build()).result()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ public static CompletableFuture getPublicKeyPlain() { return getPublicKeyPlain(GetPublicKeyPlainArgs.Empty, InvokeOptions.Empty); @@ -58,6 +152,53 @@ public static CompletableFuture getPublicKeyPlain() { * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.PrivateKey; + * import com.pulumi.tls.PrivateKeyArgs; + * import com.pulumi.tls.TlsFunctions; + * import com.pulumi.tls.inputs.GetPublicKeyArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() + * .algorithm("ED25519") + * .build()); + * + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyPem(ed25519_example.privateKeyPem()) + * .build()); + * + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyOpenssh(StdFunctions.file(FileArgs.builder() + * .input("~/.ssh/id_rsa_rfc4716") + * .build()).result()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ public static Output getPublicKey(GetPublicKeyArgs args) { return getPublicKey(args, InvokeOptions.Empty); @@ -67,6 +208,53 @@ public static Output getPublicKey(GetPublicKeyArgs args) { * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.PrivateKey; + * import com.pulumi.tls.PrivateKeyArgs; + * import com.pulumi.tls.TlsFunctions; + * import com.pulumi.tls.inputs.GetPublicKeyArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() + * .algorithm("ED25519") + * .build()); + * + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyPem(ed25519_example.privateKeyPem()) + * .build()); + * + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyOpenssh(StdFunctions.file(FileArgs.builder() + * .input("~/.ssh/id_rsa_rfc4716") + * .build()).result()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ public static CompletableFuture getPublicKeyPlain(GetPublicKeyPlainArgs args) { return getPublicKeyPlain(args, InvokeOptions.Empty); @@ -76,6 +264,53 @@ public static CompletableFuture getPublicKeyPlain(GetPublicK * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.PrivateKey; + * import com.pulumi.tls.PrivateKeyArgs; + * import com.pulumi.tls.TlsFunctions; + * import com.pulumi.tls.inputs.GetPublicKeyArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() + * .algorithm("ED25519") + * .build()); + * + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyPem(ed25519_example.privateKeyPem()) + * .build()); + * + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyOpenssh(StdFunctions.file(FileArgs.builder() + * .input("~/.ssh/id_rsa_rfc4716") + * .build()).result()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ public static Output getPublicKey(GetPublicKeyArgs args, InvokeOptions options) { return Deployment.getInstance().invoke("tls:index/getPublicKey:getPublicKey", TypeShape.of(GetPublicKeyResult.class), args, Utilities.withVersion(options)); @@ -85,6 +320,53 @@ public static Output getPublicKey(GetPublicKeyArgs args, Inv * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.tls.PrivateKey; + * import com.pulumi.tls.PrivateKeyArgs; + * import com.pulumi.tls.TlsFunctions; + * import com.pulumi.tls.inputs.GetPublicKeyArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var ed25519_example = new PrivateKey("ed25519-example", PrivateKeyArgs.builder() + * .algorithm("ED25519") + * .build()); + * + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * final var privateKeyPem-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyPem(ed25519_example.privateKeyPem()) + * .build()); + * + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * final var privateKeyOpenssh-example = TlsFunctions.getPublicKey(GetPublicKeyArgs.builder() + * .privateKeyOpenssh(StdFunctions.file(FileArgs.builder() + * .input("~/.ssh/id_rsa_rfc4716") + * .build()).result()) + * .build()); + * + * } + * } + * ``` + * <!--End PulumiCodeChooser --> + * */ public static CompletableFuture getPublicKeyPlain(GetPublicKeyPlainArgs args, InvokeOptions options) { return Deployment.getInstance().invokeAsync("tls:index/getPublicKey:getPublicKey", TypeShape.of(GetPublicKeyResult.class), args, Utilities.withVersion(options)); diff --git a/sdk/nodejs/certRequest.ts b/sdk/nodejs/certRequest.ts index d3947f9b..a77a9a51 100644 --- a/sdk/nodejs/certRequest.ts +++ b/sdk/nodejs/certRequest.ts @@ -8,6 +8,24 @@ import * as utilities from "./utilities"; /** * ## Example Usage + * + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as std from "@pulumi/std"; + * import * as tls from "@pulumi/tls"; + * + * const example = new tls.CertRequest("example", { + * privateKeyPem: std.file({ + * input: "private_key.pem", + * }).then(invoke => invoke.result), + * subject: { + * commonName: "example.com", + * organization: "ACME Examples, Inc", + * }, + * }); + * ``` + * */ export class CertRequest extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/getPublicKey.ts b/sdk/nodejs/getPublicKey.ts index f36edcba..f978ba9b 100644 --- a/sdk/nodejs/getPublicKey.ts +++ b/sdk/nodejs/getPublicKey.ts @@ -8,6 +8,28 @@ import * as utilities from "./utilities"; * Get a public key from a PEM-encoded private key. * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. + * + * ## Example Usage + * + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as std from "@pulumi/std"; + * import * as tls from "@pulumi/tls"; + * + * const ed25519_example = new tls.PrivateKey("ed25519-example", {algorithm: "ED25519"}); + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * const privateKeyPem-example = tls.getPublicKeyOutput({ + * privateKeyPem: ed25519_example.privateKeyPem, + * }); + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * const privateKeyOpenssh-example = std.file({ + * input: "~/.ssh/id_rsa_rfc4716", + * }).then(invoke => tls.getPublicKey({ + * privateKeyOpenssh: invoke.result, + * })); + * ``` + * */ export function getPublicKey(args?: GetPublicKeyArgs, opts?: pulumi.InvokeOptions): Promise { args = args || {}; @@ -74,6 +96,28 @@ export interface GetPublicKeyResult { * Get a public key from a PEM-encoded private key. * * Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. + * + * ## Example Usage + * + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as std from "@pulumi/std"; + * import * as tls from "@pulumi/tls"; + * + * const ed25519_example = new tls.PrivateKey("ed25519-example", {algorithm: "ED25519"}); + * // Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + * const privateKeyPem-example = tls.getPublicKeyOutput({ + * privateKeyPem: ed25519_example.privateKeyPem, + * }); + * // Public key loaded from filesystem, using the Open SSH (RFC 4716) format + * const privateKeyOpenssh-example = std.file({ + * input: "~/.ssh/id_rsa_rfc4716", + * }).then(invoke => tls.getPublicKey({ + * privateKeyOpenssh: invoke.result, + * })); + * ``` + * */ export function getPublicKeyOutput(args?: GetPublicKeyOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { return pulumi.output(args).apply((a: any) => getPublicKey(a, opts)) diff --git a/sdk/python/pulumi_tls/cert_request.py b/sdk/python/pulumi_tls/cert_request.py index e3367748..597bcd99 100644 --- a/sdk/python/pulumi_tls/cert_request.py +++ b/sdk/python/pulumi_tls/cert_request.py @@ -234,6 +234,21 @@ def __init__(__self__, """ ## Example Usage + + ```python + import pulumi + import pulumi_std as std + import pulumi_tls as tls + + example = tls.CertRequest("example", + private_key_pem=std.file(input="private_key.pem").result, + subject=tls.CertRequestSubjectArgs( + common_name="example.com", + organization="ACME Examples, Inc", + )) + ``` + + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Sequence[pulumi.Input[str]]] dns_names: List of DNS names for which a certificate is being requested (i.e. certificate subjects). @@ -251,6 +266,21 @@ def __init__(__self__, """ ## Example Usage + + ```python + import pulumi + import pulumi_std as std + import pulumi_tls as tls + + example = tls.CertRequest("example", + private_key_pem=std.file(input="private_key.pem").result, + subject=tls.CertRequestSubjectArgs( + common_name="example.com", + organization="ACME Examples, Inc", + )) + ``` + + :param str resource_name: The name of the resource. :param CertRequestArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_tls/get_public_key.py b/sdk/python/pulumi_tls/get_public_key.py index fbb37656..046f3723 100644 --- a/sdk/python/pulumi_tls/get_public_key.py +++ b/sdk/python/pulumi_tls/get_public_key.py @@ -136,6 +136,22 @@ def get_public_key(private_key_openssh: Optional[str] = None, Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. + ## Example Usage + + + ```python + import pulumi + import pulumi_std as std + import pulumi_tls as tls + + ed25519_example = tls.PrivateKey("ed25519-example", algorithm="ED25519") + # Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + private_key_pem_example = tls.get_public_key_output(private_key_pem=ed25519_example.private_key_pem) + # Public key loaded from filesystem, using the Open SSH (RFC 4716) format + private_key_openssh_example = tls.get_public_key(private_key_openssh=std.file(input="~/.ssh/id_rsa_rfc4716").result) + ``` + + :param str private_key_openssh: The private key (in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format) to extract the public key from. This is *mutually exclusive* with `private_key_pem`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. :param str private_key_pem: The private key (in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format) to extract the public key from. This is *mutually exclusive* with `private_key_openssh`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. @@ -166,6 +182,22 @@ def get_public_key_output(private_key_openssh: Optional[pulumi.Input[Optional[st Use this data source to get the public key from a [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) or [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) formatted private key, for use in other resources. + ## Example Usage + + + ```python + import pulumi + import pulumi_std as std + import pulumi_tls as tls + + ed25519_example = tls.PrivateKey("ed25519-example", algorithm="ED25519") + # Public key loaded from a terraform-generated private key, using the PEM (RFC 1421) format + private_key_pem_example = tls.get_public_key_output(private_key_pem=ed25519_example.private_key_pem) + # Public key loaded from filesystem, using the Open SSH (RFC 4716) format + private_key_openssh_example = tls.get_public_key(private_key_openssh=std.file(input="~/.ssh/id_rsa_rfc4716").result) + ``` + + :param str private_key_openssh: The private key (in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format) to extract the public key from. This is *mutually exclusive* with `private_key_pem`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`. :param str private_key_pem: The private key (in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format) to extract the public key from. This is *mutually exclusive* with `private_key_openssh`. Currently-supported algorithms for keys are: `RSA`, `ECDSA`, `ED25519`.