Flux
I want to use the Pulumi Flux package (flux) in my project.
## Provider details
- Package: flux
- Version: v1.0.1
- Publisher: oun
- Source: pulumi
- Repository: https://github.com/oun/pulumi-flux
## Documentation
The Pulumi Cloud Registry API serves canonical, up-to-date docs for this package — including private packages and every published version. Send the "Accept: text/markdown" header for clean readable content, or "application/json" for structured data.
Start at the navigation tree, which cross-links to the readme, installation guide, and per-resource docs URL template:
- https://api.pulumi.com/api/registry/packages/pulumi/oun/flux/versions/latest/nav
Returns a summary by default. The full tree can be hundreds of kB for large providers, so prefer targeted search: append "?q=<query>&depth=full" to filter by resource/function title or token (for example "?q=bucket&depth=full"). Only request the full nav without a query if you actually need to enumerate every resource.
Other endpoints:
- Overview and getting started: https://api.pulumi.com/api/registry/packages/pulumi/oun/flux/versions/latest/readme
- Installation and configuration: https://api.pulumi.com/api/registry/packages/pulumi/oun/flux/versions/latest/installation
- Per-resource/function docs: https://api.pulumi.com/api/registry/packages/pulumi/oun/flux/versions/latest/docs/{token}?lang={lang}
Replace {token} with the percent-encoded token from the nav response (for example aws:s3/bucket:Bucket).
Replace {lang} with typescript, python, go, csharp, java, or yaml.
Fetch the installation endpoint above for the correct setup steps — install instructions vary between native providers, bridged Terraform providers, and component packages.
Help me get started using this provider. Show me a complete Pulumi program that provisions a common resource, including all necessary configuration and imports.
The Pulumi Flux provider lets you manage Flux resources.
Example
import * as pulumi from "@pulumi/pulumi";
import * as tls from "@pulumi/tls";
import * as github from "@pulumi/github";
import * as flux from "@worawat/flux";
// Require Github configurations
// export GITHUB_TOKEN=your-github-personal-access-token
// export GITHUB_OWNER=your-github-owner
const repoName = "your-github-repo";
const branch = "main";
const path = "clusters/dev";
const githubOwner = "your-github-user";
// Generate ssh keys
const key = new tls.PrivateKey("key", {
algorithm: "ECDSA",
ecdsaCurve: "P256",
});
// Create Github repository
const repo = new github.Repository("repo", {
name: repoName,
visibility: "private",
autoInit: true,
});
new github.BranchDefault("default", {
repository: repo.name,
branch: branch,
});
// Add generated public key to Github deploy key
const deployKey = new github.RepositoryDeployKey("key", {
title: "fluxcd",
repository: repo.name,
key: key.publicKeyOpenssh,
readOnly: false,
});
const provider = new flux.Provider("flux", {
kubernetes: {
configPath: "~/.kube/config",
},
git: {
url: `ssh://git@github.com/${githubOwner}/${repoName}.git`,
branch: branch,
ssh: {
username: "git",
privateKey: key.privateKeyPem,
},
},
});
const resource = new flux.FluxBootstrapGit(
"flux",
{
path: path,
},
{
provider: provider,
dependsOn: deployKey,
}
);
import pulumi
import pulumi_flux as flux
import pulumi_github as github
import pulumi_tls as tls
# Require Github configurations
# export GITHUB_TOKEN=your-github-personal-access-token
# export GITHUB_OWNER=your-github-owner
branch = "main"
target_path = "clusters/dev"
repo_name = "your-github-repo"
github_owner = "your-github-user"
ssh_key = tls.PrivateKey("key", algorithm="ECDSA", ecdsa_curve="P256")
repository = github.Repository(
"flux", name=repo_name, visibility="private", auto_init=True
)
github.BranchDefault("default", repository=repository.name, branch=branch)
deploy_key = github.RepositoryDeployKey(
"flux-key",
title="flux",
repository=repository.name,
key=ssh_key.public_key_openssh,
read_only=False,
)
provider = flux.Provider(
"flux",
kubernetes=flux.ProviderKubernetesArgs(config_path="~/.kube/config"),
git=flux.ProviderGitArgs(
url=f"ssh://git@github.com/{github_owner}/{repo_name}.git",
branch=branch,
ssh=flux.ProviderGitSshArgs(username="git", private_key=ssh_key.private_key_pem)
)
)
resource = flux.FluxBootstrapGit(
"flux",
path=target_path,
opts=pulumi.ResourceOptions(provider=provider, depends_on=deploy_key)
)
import (
"fmt"
flux "github.com/oun/pulumi-flux/sdk/go/flux"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
using Pulumi;
using Pulumi.Flux;