搜索

PythonReactSEOPDF
GitHub Skill

pulumi-basics

Use when writing infrastructure-as-code with Pulumi using programming languages for cloud resource provisioning.

TheBushidoCollective☆ 75 仓库 Stars10 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Pulumi Basics

Infrastructure-as-code using real programming languages with Pulumi.

Project Structure

my-infrastructure/
├── Pulumi.yaml       # Project file
├── Pulumi.dev.yaml   # Stack config
├── index.ts          # Main program
└── package.json

Pulumi.yaml

name: my-infrastructure
runtime: nodejs
description: My infrastructure project

TypeScript Example

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Create VPC
const vpc = new aws.ec2.Vpc("main", {
    cidrBlock: "10.0.0.0/16",
    enableDnsHostnames: true,
    tags: {
        Name: "main-vpc",
    },
});

// Create subnet
const subnet = new aws.ec2.Subnet("public", {
    vpcId: vpc.id,
    cidrBlock: "10.0.1.0/24",
    availabilityZone: "us-east-1a",
});

// Export outputs
export const vpcId = vpc.id;
export const subnetId = subnet.id;

Common Commands

# Create new project
pulumi new aws-typescript

# Preview changes
pulumi preview

# Apply changes
pulumi up

# Destroy resources
pulumi destroy

# View stack outputs
pulumi stack output

Configuration

# Set config
pulumi config set aws:region us-east-1

# Set secret
pulumi config set --secret dbPassword mySecret123

# Get config
pulumi config get aws:region

Best Practices

Use Stack References
const infraStack = new pulumi.StackReference("org/infra/prod");
const vpcId = infraStack.getOutput("vpcId");
Component Resources
class MyApp extends pulumi.ComponentResource {
    constructor(name: string, args: MyAppArgs, opts?: pulumi.ComponentResourceOptions) {
        super("custom:app:MyApp", name, {}, opts);
        
        // Create resources
    }
}

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-02-04
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!