diff --git a/provider/cmd/pulumi-gen-eks/main.go b/provider/cmd/pulumi-gen-eks/main.go index a4450a7f..d5f8f1e3 100644 --- a/provider/cmd/pulumi-gen-eks/main.go +++ b/provider/cmd/pulumi-gen-eks/main.go @@ -149,9 +149,32 @@ func generateSchema() schema.PackageSpec { // TODO: method: createNodeGroup(name: string, args: ClusterNodeGroupOptions): NodeGroup IsComponent: true, ObjectTypeSpec: schema.ObjectTypeSpec{ - Description: "Cluster is a component that wraps the AWS and Kubernetes resources necessary to " + - "run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional " + - "deployment of the Kubernetes Dashboard.", + Description: "Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard.\n\n" + + "## Example Usage\n\n### Provisioning a New EKS Cluster\n\n" + + "\n" + + // TS example + "```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as eks from \"@pulumi/eks\";\n\n" + + "// Create an EKS cluster with the default configuration.\nconst cluster = new eks.Cluster(\"cluster\", {});\n\n" + + "// Export the cluster's kubeconfig.\nexport const kubeconfig = cluster.kubeconfig;\n ```\n\n" + + // Python example + "```python\n import pulumi\n import pulumi_eks as eks\n \n # Create an EKS cluster with the default configuration.\n cluster = eks.Cluster(\"cluster\")\n\n " + + "# Export the cluster's kubeconfig.\n pulumi.export(\"kubeconfig\", cluster.kubeconfig)\n ```\n\n" + + // Go example + "```go\n package main\n \n import (\n \t\"github.com/pulumi/pulumi-eks/sdk/go/eks\"\n \t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n )\n\n" + + "func main() {\n \tpulumi.Run(func(ctx *pulumi.Context) error {\n \t\t// Create an EKS cluster with the default configuration.\n" + + "\t\tcluster, err := eks.NewCluster(ctx, \"cluster\", nil)\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n \t\t// Export the cluster's kubeconfig.\n \t\tctx.Export(\"kubeconfig\", cluster.Kubeconfig)\n" + + "\t\treturn nil\n \t})\n }\n ```\n\n" + + // C# example + "```csharp\n using System.Collections.Generic;\n using Pulumi;\n using Eks = Pulumi.Eks;\n \n return await Deployment.RunAsync(() =>\n {\n \t// Create an EKS cluster with the default configuration.\n" + + "\tvar cluster = new Eks.Cluster(\"cluster\");\n \n \treturn new Dictionary\n \t{\n \t\t// Export the cluster's kubeconfig.\n \t\t[\"kubeconfig\"] = cluster.Kubeconfig,\n \t};\n });\n\n```\n\n" + + // Java example + "```java\n import com.pulumi.Context;\n import com.pulumi.Pulumi;\n import com.pulumi.core.Output;\n import com.pulumi.eks.Cluster;\n import java.util.List;\n import java.util.ArrayList;\n import java.util.Map;\n" + + " import java.io.File;\n import java.nio.file.Files;\n import java.nio.file.Paths;\n \n public class App {\n \tpublic static void main(String[] args) {\n \t\tPulumi.run(App::stack);\n \t}\n \n" + + "\t public static void stack(Context ctx) {\n \t\t// Create an EKS cluster with the default configuration.\n \t\tvar cluster = new Cluster(\"cluster\");\n \n \t\t// Export the cluster's kubeconfig.\n" + + "\t\tctx.export(\"kubeconfig\", cluster.kubeconfig());\n \t}\n }\n ```\n\n" + + "```yaml\nresources:\n# Create an EKS cluster with the default configuration.\ncluster:\ntype: eks:Cluster\noutputs:\n# Export the cluster's kubeconfig.\n" + + "kubeconfig: ${cluster.kubeconfig}\n\n```\n" + + "", Properties: map[string]schema.PropertySpec{ "kubeconfig": { TypeSpec: schema.TypeSpec{Ref: "pulumi.json#/Any"}, diff --git a/provider/cmd/pulumi-resource-eks/schema.json b/provider/cmd/pulumi-resource-eks/schema.json index 512753a9..8c33df75 100644 --- a/provider/cmd/pulumi-resource-eks/schema.json +++ b/provider/cmd/pulumi-resource-eks/schema.json @@ -604,7 +604,7 @@ "provider": {}, "resources": { "eks:index:Cluster": { - "description": "Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard.\n\n## Example Usage\n\n### Provisioning a New EKS Cluster\n\n ```typescript\n import * as pulumi from \"@pulumi\/pulumi\";\n import * as eks from \"@pulumi\/eks\";\n\n \/\/ Create an EKS cluster with the default configuration.\n const cluster = new eks.Cluster(\"cluster\", {});\n\n \/\/ Export the cluster's kubeconfig.\n export const kubeconfig = cluster.kubeconfig;\n ```\n \n {{% \/choosable %}}\n {{% choosable language python %}}\n\n ```python\n import pulumi\n import pulumi_eks as eks\n \n # Create an EKS cluster with the default configuration.\n cluster = eks.Cluster(\"cluster\")\n \n # Export the cluster's kubeconfig.\n pulumi.export(\"kubeconfig\", cluster.kubeconfig)\n ```\n \n {{% \/choosable %}}\n {{% choosable language go %}}\n \n ```go\n package main\n \n import (\n \t\"github.com\/pulumi\/pulumi-eks\/sdk\/go\/eks\"\n \t\"github.com\/pulumi\/pulumi\/sdk\/v3\/go\/pulumi\"\n )\n \n func main() {\n \tpulumi.Run(func(ctx *pulumi.Context) error {\n \t\t\/\/ Create an EKS cluster with the default configuration.\n \t\tcluster, err := eks.NewCluster(ctx, \"cluster\", nil)\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n \t\t\/\/ Export the cluster's kubeconfig.\n \t\tctx.Export(\"kubeconfig\", cluster.Kubeconfig)\n \t\treturn nil\n \t})\n }\n ```\n \n {{% \/choosable %}}\n {{% choosable language csharp %}}\n \n ```csharp\n using System.Collections.Generic;\n using Pulumi;\n using Eks = Pulumi.Eks;\n \n return await Deployment.RunAsync(() =>\n {\n \t\/\/ Create an EKS cluster with the default configuration.\n \tvar cluster = new Eks.Cluster(\"cluster\");\n \n \treturn new Dictionary\n \t{\n \t\t\/\/ Export the cluster's kubeconfig.\n \t\t[\"kubeconfig\"] = cluster.Kubeconfig,\n \t};\n });\n ```\n \n {{% \/choosable %}}\n {{% choosable language java %}}\n \n ```java\n import com.pulumi.Context;\n import com.pulumi.Pulumi;\n import com.pulumi.core.Output;\n import com.pulumi.eks.Cluster;\n import java.util.List;\n import java.util.ArrayList;\n import java.util.Map;\n import java.io.File;\n import java.nio.file.Files;\n import java.nio.file.Paths;\n \n public class App {\n \tpublic static void main(String[] args) {\n \t\tPulumi.run(App::stack);\n \t}\n \n\t public static void stack(Context ctx) {\n \t\t\/\/ Create an EKS cluster with the default configuration.\n \t\tvar cluster = new Cluster(\"cluster\");\n \n \t\t\/\/ Export the cluster's kubeconfig.\n \t\tctx.export(\"kubeconfig\", cluster.kubeconfig());\n \t}\n }\n ```\n \n {{% \/choosable %}}\n {{% choosable language yaml %}}\n \n ```yaml\n resources:\n # Create an EKS cluster with the default configuration.\n cluster:\n type: eks:Cluster\n outputs:\n # Export the cluster's kubeconfig.\n kubeconfig: ${cluster.kubeconfig}\n \n ```\n ", + "description": "Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard.\n\n## Example Usage\n\n### Provisioning a New EKS Cluster\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as eks from \"@pulumi/eks\";\n\n// Create an EKS cluster with the default configuration.\nconst cluster = new eks.Cluster(\"cluster\", {});\n\n// Export the cluster's kubeconfig.\nexport const kubeconfig = cluster.kubeconfig;\n ```\n\n```python\n import pulumi\n import pulumi_eks as eks\n \n # Create an EKS cluster with the default configuration.\n cluster = eks.Cluster(\"cluster\")\n\n # Export the cluster's kubeconfig.\n pulumi.export(\"kubeconfig\", cluster.kubeconfig)\n ```\n\n```go\n package main\n \n import (\n \t\"github.com/pulumi/pulumi-eks/sdk/go/eks\"\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// Create an EKS cluster with the default configuration.\n\t\tcluster, err := eks.NewCluster(ctx, \"cluster\", nil)\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n \t\t// Export the cluster's kubeconfig.\n \t\tctx.Export(\"kubeconfig\", cluster.Kubeconfig)\n\t\treturn nil\n \t})\n }\n ```\n\n```csharp\n using System.Collections.Generic;\n using Pulumi;\n using Eks = Pulumi.Eks;\n \n return await Deployment.RunAsync(() =\u003e\n {\n \t// Create an EKS cluster with the default configuration.\n\tvar cluster = new Eks.Cluster(\"cluster\");\n \n \treturn new Dictionary\u003cstring, object?\u003e\n \t{\n \t\t// Export the cluster's kubeconfig.\n \t\t[\"kubeconfig\"] = cluster.Kubeconfig,\n \t};\n });\n\n```\n\n```java\n import com.pulumi.Context;\n import com.pulumi.Pulumi;\n import com.pulumi.core.Output;\n import com.pulumi.eks.Cluster;\n import java.util.List;\n import java.util.ArrayList;\n import java.util.Map;\n import java.io.File;\n import java.nio.file.Files;\n import java.nio.file.Paths;\n \n public class App {\n \tpublic static void main(String[] args) {\n \t\tPulumi.run(App::stack);\n \t}\n \n\t public static void stack(Context ctx) {\n \t\t// Create an EKS cluster with the default configuration.\n \t\tvar cluster = new Cluster(\"cluster\");\n \n \t\t// Export the cluster's kubeconfig.\n\t\tctx.export(\"kubeconfig\", cluster.kubeconfig());\n \t}\n }\n ```\n\n```yaml\nresources:\n# Create an EKS cluster with the default configuration.\ncluster:\ntype: eks:Cluster\noutputs:\n# Export the cluster's kubeconfig.\nkubeconfig: ${cluster.kubeconfig}\n\n```\n\u003c!--End PulumiCodeChooser --\u003e", "properties": { "awsProvider": { "$ref": "/aws/v6.5.0/schema.json#/provider", diff --git a/sdk/dotnet/Cluster.cs b/sdk/dotnet/Cluster.cs index 76e58caa..52d4b7cb 100644 --- a/sdk/dotnet/Cluster.cs +++ b/sdk/dotnet/Cluster.cs @@ -11,6 +11,32 @@ namespace Pulumi.Eks { /// /// Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard. + /// + /// ## Example Usage + /// + /// ### Provisioning a New EKS Cluster + /// + /// <!--Start PulumiCodeChooser --> + /// + /// ```csharp + /// using System.Collections.Generic; + /// using Pulumi; + /// using Eks = Pulumi.Eks; + /// + /// return await Deployment.RunAsync(() => + /// { + /// // Create an EKS cluster with the default configuration. + /// var cluster = new Eks.Cluster("cluster"); + /// + /// return new Dictionary<string, object?> + /// { + /// // Export the cluster's kubeconfig. + /// ["kubeconfig"] = cluster.Kubeconfig, + /// }; + /// }); + /// + /// ``` + /// <!--End PulumiCodeChooser --> /// [EksResourceType("eks:index:Cluster")] public partial class Cluster : global::Pulumi.ComponentResource diff --git a/sdk/go/eks/cluster.go b/sdk/go/eks/cluster.go index 3f30ac76..9d0de073 100644 --- a/sdk/go/eks/cluster.go +++ b/sdk/go/eks/cluster.go @@ -16,6 +16,37 @@ import ( ) // Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard. +// +// ## Example Usage +// +// ### Provisioning a New EKS Cluster +// +// +// +// ```go +// +// package main +// +// import ( +// "github.com/pulumi/pulumi-eks/sdk/go/eks" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// // Create an EKS cluster with the default configuration. +// cluster, err := eks.NewCluster(ctx, "cluster", nil) +// if err != nil { +// return err +// } +// // Export the cluster's kubeconfig. +// ctx.Export("kubeconfig", cluster.Kubeconfig) +// return nil +// }) +// } +// +// ``` +// type Cluster struct { pulumi.ResourceState diff --git a/sdk/python/pulumi_eks/cluster.py b/sdk/python/pulumi_eks/cluster.py index d67adf02..4f64a0da 100644 --- a/sdk/python/pulumi_eks/cluster.py +++ b/sdk/python/pulumi_eks/cluster.py @@ -1085,6 +1085,24 @@ def __init__(__self__, """ Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard. + ## Example Usage + + ### Provisioning a New EKS Cluster + + + + ```python + import pulumi + import pulumi_eks as eks + + # Create an EKS cluster with the default configuration. + cluster = eks.Cluster("cluster") + + # Export the cluster's kubeconfig. + pulumi.export("kubeconfig", cluster.kubeconfig) + ``` + + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input['pulumi_aws.ec2.SecurityGroup'] cluster_security_group: The security group to use for the cluster API endpoint. If not provided, a new security group will be created with full internet egress and ingress from node groups. @@ -1263,6 +1281,24 @@ def __init__(__self__, """ Cluster is a component that wraps the AWS and Kubernetes resources necessary to run an EKS cluster, its worker nodes, its optional StorageClasses, and an optional deployment of the Kubernetes Dashboard. + ## Example Usage + + ### Provisioning a New EKS Cluster + + + + ```python + import pulumi + import pulumi_eks as eks + + # Create an EKS cluster with the default configuration. + cluster = eks.Cluster("cluster") + + # Export the cluster's kubeconfig. + pulumi.export("kubeconfig", cluster.kubeconfig) + ``` + + :param str resource_name: The name of the resource. :param ClusterArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource.