Skip to content

Commit

Permalink
Merging existing content with rproposed rewrites in this PR, fixed br…
Browse files Browse the repository at this point in the history
…oken links, etc.
  • Loading branch information
David Wrede committed Jan 11, 2021
1 parent 260d8aa commit eba9bc5
Show file tree
Hide file tree
Showing 64 changed files with 4,735 additions and 5,192 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -17,14 +17,14 @@ We generally use Hugo's [`relref` shortcode](https://gohugo.io/content-managemen

```markdown
[Install]({{< relref "/docs/get-started/install" >}})
[Outputs]({{< relref "/docs/intro/concepts/programming-model#stack-outputs" >}})
[Outputs]({{< relref "/docs/intro/concepts/stack#outputs" >}})
```

Which, on a page inside the `./content/reference` directory, will generate:

```html
<a href="/docs/install/">Install</a>
<a href="/docs/intro/concepts/programming-model/#stack-outputs">Outputs</a>
<a href="/docs/intro/concepts/stack/#stack-outputs">Outputs</a>
```

### Hugo tips
Expand Down
2 changes: 1 addition & 1 deletion content/blog/advanced-typescript-type-ftw/index.md
Expand Up @@ -13,7 +13,7 @@ how this works for infrastructure as code can be fascinating!
<!--more-->

A core part of the Pulumi [programming model]({{< relref "/docs/reference" >}}) is that we allow people to express complex
[dependency data]({{< relref "/docs/intro/concepts/programming-model#outputs" >}}) that may _eventually_ be available.
[dependency data]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) that may _eventually_ be available.
Traditional JavaScript programming might expose that as a Promise<T>, but we’ve taken that one step further by introducing
a type we call:

Expand Down
2 changes: 1 addition & 1 deletion content/blog/amazon-eks-distro/index.md
Expand Up @@ -30,7 +30,7 @@ If you're already a user of Amazon EKS, you're already getting all of the benefi

Installing an Amazon EKS Distro cluster involves bootstrapping a Kubernetes cluster but with the images provided by the Amazon EKS team. The simplest way to provision a Kubernetes cluster is using [kops](https://kops.sigs.k8s.io/) and the Amazon EKS Distro team provides instructions on how to replace the default Kubernetes components with the Amazon EKS Distro built parts.

It's possible to get all of the benefits of provisioning a Kubernetes cluster with kops while also taking part in the Pulumi resource lifecycle. Pulumi offers support for running arbitrary commands using [dynamic providers](https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders) (available in the JavaScript, Typescript and Python SDKs) and you can register the kops commands used to create and destroy clusters as dynamic provider callbacks. Once your Kubernetes cluster has been created, you can provision Kubernetes resources using Pulumi's Kubernetes provider, using the Pulumi resource model to set dependencies on the created cluster.
It's possible to get all of the benefits of provisioning a Kubernetes cluster with kops while also taking part in the Pulumi resource lifecycle. Pulumi offers support for running arbitrary commands using [dynamic providers]({{< relref "/docs/intro/concepts/resources#dynamicproviders" >}}) (available in the JavaScript, Typescript and Python SDKs) and you can register the kops commands used to create and destroy clusters as dynamic provider callbacks. Once your Kubernetes cluster has been created, you can provision Kubernetes resources using Pulumi's Kubernetes provider, using the Pulumi resource model to set dependencies on the created cluster.

### Creating an Amazon EKS Distro cluster with Pulumi

Expand Down
2 changes: 1 addition & 1 deletion content/blog/architecture-as-code-microservices/index.md
Expand Up @@ -35,7 +35,7 @@ We'll use the [AWS Stack Reference example](https://github.com/pulumi/examples/t

Let's examine how it creates reusable components for building out resources. First up is the [VPC class](https://github.com/pulumi/examples/blob/master/aws-stackreference-architecture/networking/src/vpc.ts) in the [networking stack](https://github.com/pulumi/examples/tree/master/aws-stackreference-architecture/networking).

In the networking service, [`vpc.ts`](https://github.com/pulumi/examples/blob/master/aws-stackreference-architecture/networking/src/vpc.ts) creates a TypeScript class that extends Pulumi [ComponentResource]({{< relref "/docs/intro/concepts/programming-model#resources" >}}). A ComponentResource abstracts one or more children that do not require custom create, read, update, and delete operations for provisioning. We can add the related resources to the correct parent to build out the class.
In the networking service, [`vpc.ts`](https://github.com/pulumi/examples/blob/master/aws-stackreference-architecture/networking/src/vpc.ts) creates a TypeScript class that extends Pulumi [ComponentResource]({{< relref "/docs/intro/concepts/resources" >}}). A ComponentResource abstracts one or more children that do not require custom create, read, update, and delete operations for provisioning. We can add the related resources to the correct parent to build out the class.

```ts
export class Vpc extends ComponentResource {
Expand Down
2 changes: 1 addition & 1 deletion content/blog/architecture-as-code-serverless/index.md
Expand Up @@ -100,7 +100,7 @@ rpa = aws.iam.RolePolicyAttachment('task-exec-policy',
)
```

To learn more about creating [reusable components]({{< relref "/docs/intro/concepts/programming-model#components" >}}), read about Pulumi's programming model, which shows how to author components.
To learn more about creating [reusable components]({{< relref "/docs/intro/concepts/resources#components" >}}), read about Pulumi's programming model, which shows how to author components.

## Polyglot applications

Expand Down
2 changes: 1 addition & 1 deletion content/blog/architecture-as-code-vm/index.md
Expand Up @@ -113,7 +113,7 @@ Now we have a virtual machine that can receive HTTP and HTTPS requests and allow

Provisioning a VM when it's created by running user-supplied scripts is relatively straightforward. For example, AWS EC2 instances have a userData parameter that allows you to specify an inline script that runs when the instance starts. But what if you need to copy and execute scripts on the virtual machine without replacing the instance?

This where you can use Pulumi’s [dynamic provider]({{< relref "/docs/intro/concepts/programming-model#dynamicproviders" >}}) to provision existing instances. Dynamic providers enable creating custom resource types, such as provisioners, within the source code of your Pulumi program. They let you execute arbitrary code during the deployment process. Dynamic provisioners run during resource provisioning, and enable adding custom logic to a deployment workflow during the create, read, update, or delete steps of a Pulumi program.
This where you can use Pulumi’s [dynamic provider]({{< relref "/docs/intro/concepts/resources#dynamicproviders" >}}) to provision existing instances. Dynamic providers enable creating custom resource types, such as provisioners, within the source code of your Pulumi program. They let you execute arbitrary code during the deployment process. Dynamic provisioners run during resource provisioning, and enable adding custom logic to a deployment workflow during the create, read, update, or delete steps of a Pulumi program.

Let's look at the code which creates a dynamic provisioner. In the code below, if Pulumi doesn't find the resource, it creates the resource. However, if you run `pulumi up` again and the resource is already running, Pulumi uses the diff method to replace the resource.

Expand Down
2 changes: 1 addition & 1 deletion content/blog/automation-api-as-platform/index.md
Expand Up @@ -24,7 +24,7 @@ This example demonstrates how to create infrastructure with Automation API and t

### Infrastructure as a function

We use an `inline` Pulumi program that doesn't require a separate package with `index.ts` and `Pulumi.yaml` files, although they can be authored in an `index.ts` file or imported from another package. The example deploys an AWS S3 website with the context and deployment automation defined in a function. Functions can be [components]({{< relref "/docs/intro/concepts/programming-model#components" >}}), in this case, a static S3 website. However, they can be more complex, such as a Kubernetes cluster with accompanying containers and AWS resources.
We use an `inline` Pulumi program that doesn't require a separate package with `index.ts` and `Pulumi.yaml` files, although they can be authored in an `index.ts` file or imported from another package. The example deploys an AWS S3 website with the context and deployment automation defined in a function. Functions can be [components]({{< relref "/docs/intro/concepts/resources#components" >}}), in this case, a static S3 website. However, they can be more complex, such as a Kubernetes cluster with accompanying containers and AWS resources.

```typescript
const projectName = "pulumi_over_http";
Expand Down
2 changes: 1 addition & 1 deletion content/blog/automation-api-workflow/index.md
Expand Up @@ -96,7 +96,7 @@ Let's break down the infrastructure piece by piece, starting with setting up con
$ aws secretsmanager create-secret --name dbpass --secret-string hellosql
```
We retrieve the secret with a function that retrieves it as a Pulumi [output]({{< relref "/docs/intro/concepts/programming-model#outputs" >}}) and returns it as a string type, which is the type that Aurora MySQL requires for the `masterpassword` property. This is a little complicated because we use the secret name to retrieve the secret properties with [`getSecret`]({{< relref "/docs/reference/pkg/aws/secretsmanager" >}}), which returns the secret ARN. Then, we use the ARN to retrieve the password with [`getSecretVersion`]({{< relref "/docs/reference/pkg/aws/secretsmanager/secretversion" >}}). Note that the function is wrapped in [`async/await`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-7.html) because we will need the password before creating the database.
We retrieve the secret with a function that retrieves it as a Pulumi [output]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) and returns it as a string type, which is the type that Aurora MySQL requires for the `masterpassword` property. This is a little complicated because we use the secret name to retrieve the secret properties with [`getSecret`]({{< relref "/docs/reference/pkg/aws/secretsmanager" >}}), which returns the secret ARN. Then, we use the ARN to retrieve the password with [`getSecretVersion`]({{< relref "/docs/reference/pkg/aws/secretsmanager/secretversion" >}}). Note that the function is wrapped in [`async/await`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-7.html) because we will need the password before creating the database.
```typescript
async function getSecret(name: string) {
Expand Down
Expand Up @@ -309,7 +309,7 @@ You can continue adding new segments to the cleanup lambda to help cleanup your
## Deploying To Multiple Regions

We want to ensure that all of our regions are cleaned up; therefore, we need to change the structure of the code. We can
take advantage of [explicit provider configuration]({{< relref "/docs/intro/concepts/programming-model#explicit-provider-configuration" >}})
take advantage of [explicit provider configuration]({{< relref "/docs/intro/concepts/resources#explicit-provider-configuration" >}})
to allow us to target the deployment of a resource to a specific region.

Let's assume we want to deploy our application to `us-east-1`, `us-east-2`, `eu-west-1`, `eu-west-2` and `us-west-2`. We can
Expand Down
2 changes: 1 addition & 1 deletion content/blog/crossguard-2-0/index.md
Expand Up @@ -42,7 +42,7 @@ By default, the `enable` and `disable` commands use an organization's default Po

Policies now have access to more information about the resources under review. With access to the options, parent, and dependencies of a resource, you can now write even more thorough policies.

You may access a [resource's options]({{< relref "/docs/intro/concepts/programming-model#resourceoptions" >}}) via the `ResourceValidationArgs` parameter. In the below example, we enforce that all DynamoDB tables be `protected` to prevent data loss.
You may access a [resource's options]({{< relref "/docs/intro/concepts/resources#options" >}}) via the `ResourceValidationArgs` parameter. In the below example, we enforce that all DynamoDB tables be `protected` to prevent data loss.

```typescript
new PolicyPack("aws-policies", {
Expand Down
2 changes: 1 addition & 1 deletion content/blog/cumundi-guest-post/index.md
Expand Up @@ -21,7 +21,7 @@ At Cumundi, we build reusable libraries for our customers to set up their infras

It may come as no surprise that we also use Pulumi to manage Cumundi's own infrastructure. As a young company (founded January 1st!), it is hard to foresee how our infrastructure needs will evolve. With Pulumi, we write code in a modern programming language, and, good coding practice is not to [optimize prematurely](http://wiki.c2.com/?PrematureOptimization) because the future is unpredictable. Another coding best practice is [red-green-refactor](https://en.wikipedia.org/wiki/Test-driven_development) or formally known as Test-Driven Development. You take the current code, write a test for the new requirement, which initially fails (red). Next, you implement the code in the most straightforward way to make the test succeed (green) and you complete the cycle by refactoring the code to keep the design in proper shape.

This blog post demonstrates a TDD cycle for Pulumi code with a reduced version of the code used to configure the internal infrastructure we provide for each customer. This example focuses on one specific Pulumi resource property: [`aliases`](https://www.pulumi.com/docs/intro/concepts/programming-model/#aliases)
This blog post demonstrates a TDD cycle for Pulumi code with a reduced version of the code used to configure the internal infrastructure we provide for each customer. This example focuses on one specific Pulumi resource property: [`aliases`]({{< relref "/docs/intro/concepts/resources#aliases" >}}).

All the code is [available on Github](https://github.com/cumundi/pulumi-refactoring-aliases) if you want to follow along with a full project setup. Every step described here is committed as a separate branch with the starting point on `master`, the default branch.

Expand Down
2 changes: 1 addition & 1 deletion content/blog/deploying-minecraft-on-azure/index.md
Expand Up @@ -144,7 +144,7 @@ storage_profile=compute.StorageProfileArgs(

### Provisioning the server

Once the virtual machine has been created, we need to provision it with the Minecraft server. The `install.sh` script installs the prerequisite software, the Minecraft server, and creates the service for starting and stopping the server. We could use [scp](https://man7.org/linux/man-pages/man1/scp.1.html) to copy the install script to the virtual machine from our local machine and then [ssh](https://man7.org/linux/man-pages/man1/ssh.1.html) into a terminal to run the script. The alternative is to use a Pulumi [dynamic resource provider]({{< relref "/blog/dynamic-providers#dynamic-resource-provider" >}}) to provision the virtual machine. The `provisioners.py` script creates a dynamic provider that enable using scp to transfer files and send commands via ssh. Creating dynamic providers are beyond the scope of this article, but more information is [available]({{< relref "/docs/intro/concepts/programming-model#dynamicproviders" >}}) on the Pulumi docs.
Once the virtual machine has been created, we need to provision it with the Minecraft server. The `install.sh` script installs the prerequisite software, the Minecraft server, and creates the service for starting and stopping the server. We could use [scp](https://man7.org/linux/man-pages/man1/scp.1.html) to copy the install script to the virtual machine from our local machine and then [ssh](https://man7.org/linux/man-pages/man1/ssh.1.html) into a terminal to run the script. The alternative is to use a Pulumi [dynamic resource provider]({{< relref "/blog/dynamic-providers#dynamic-resource-provider" >}}) to provision the virtual machine. The `provisioners.py` script creates a dynamic provider that enable using scp to transfer files and send commands via ssh. Creating dynamic providers are beyond the scope of this article, but more information is [available]({{< relref "/docs/intro/concepts/resources#dynamicproviders" >}}) on the Pulumi docs.

We provision our Minecraft server by creating the `conn` connection object defined in `provisioners.py`.

Expand Down
2 changes: 1 addition & 1 deletion content/blog/dynamic-providers/index.md
Expand Up @@ -180,4 +180,4 @@ const catConfig = new provisioners.RemoteExec("cat-config", {
...
```

Read more about dynamic providers in our [docs](https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders). Let us know what cool dynamic providers you create by dropping us a note on our community [Slack](https://slack.pulumi.com/)!
Read more about dynamic providers in our [docs]({{< relref "/docs/intro/concepts/resources#dynamicproviders" >}}). Let us know what cool dynamic providers you create by dropping us a note on our community [Slack](https://slack.pulumi.com/)!
4 changes: 2 additions & 2 deletions content/blog/go-sdk-road-to-2/index.md
Expand Up @@ -54,9 +54,9 @@ Although this code looks remarkably similar to using your cloud's Go SDK to impe

Making Go a first-class citizen is a goal for the Pulumi 2.0 release. We especially wanted Go to have more idiomatic and stronger typing than `interface{}`.

Pulumi’s [programming model]({{< relref "/docs/intro/concepts/programming-model" >}}) is inherently asynchronous. Consider creating a new AWS SecurityGroup, and using it to provision an EC2 instance. The EC2 instance must wait for the Group to finish provisioning, and the Pulumi engine must track this dependency. While two resources, modern cloud deployments commonly manage hundreds of resources. Pulumi models these resources using promise-like wrappers referred to as Inputs and Outputs allowing us to build a dependency graph, and parallelize cloud resource provisioning where possible.
Pulumi’s [programming model]({{< relref "/docs/intro/concepts" >}}) is inherently asynchronous. Consider creating a new AWS SecurityGroup, and using it to provision an EC2 instance. The EC2 instance must wait for the Group to finish provisioning, and the Pulumi engine must track this dependency. While two resources, modern cloud deployments commonly manage hundreds of resources. Pulumi models these resources using promise-like wrappers referred to as Inputs and Outputs allowing us to build a dependency graph, and parallelize cloud resource provisioning where possible.

Inputs, Outputs, and functions that operate over them ([All]({{< relref "/docs/intro/concepts/programming-model#all" >}}), [Apply]({{< relref "/docs/intro/concepts/programming-model#apply" >}}), [Sprintf]({{< relref "/docs/intro/concepts/programming-model#outputs-and-strings" >}})) must be compatible with raw type primitives (string, integer, list, map, boolean), and user-defined structs. In other words, we must support polymorphism in a language that doesn’t have generics. We hide the gritty details behind a rich, strongly-typed API that we were able to iterate on easily thanks to the utilization of [code generation](https://github.com/pulumi/pulumi/blob/master/sdk/go/pulumi/types_builtins.go).
Inputs, Outputs, and functions that operate over them ([All]({{< relref "/docs/intro/concepts/inputs-outputs#all" >}}), [Apply]({{< relref "/docs/intro/concepts/inputs-outputs#apply" >}}), [Sprintf]({{< relref "/docs/intro/concepts/inputs-outputs#outputs-and-strings" >}})) must be compatible with raw type primitives (string, integer, list, map, boolean), and user-defined structs. In other words, we must support polymorphism in a language that doesn’t have generics. We hide the gritty details behind a rich, strongly-typed API that we were able to iterate on easily thanks to the utilization of [code generation](https://github.com/pulumi/pulumi/blob/master/sdk/go/pulumi/types_builtins.go).

## Try Pulumi + Go Today

Expand Down

0 comments on commit eba9bc5

Please sign in to comment.