published on Monday, Jul 27, 2026 by juju
published on Monday, Jul 27, 2026 by juju
A resource that represents a Juju secret.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as juju from "@pulumi/juju";
const my_secret = new juju.Secret("my-secret", {
modelUuid: development.uuid,
name: "my_secret_name",
value: {
key1: "value1",
key2: "value2",
},
info: "This is the secret",
});
const my_application = new juju.Application("my-application", {config: {
secret: my_secret.secretId,
}});
// Write-only secret value. The value is supplied via value_wo, which is never
// stored in Terraform state. Bumping value_wo_version triggers an update of the
// secret value. This requires Terraform >= 1.11 and pairs well with ephemeral
// resources/values.
const my_wo_secret = new juju.Secret("my-wo-secret", {
modelUuid: development.uuid,
name: "my_wo_secret_name",
valueWo: {
key1: "value1",
key2: "value2",
},
valueWoVersion: 1,
info: "This is a write-only secret",
});
import pulumi
import pulumi_juju as juju
my_secret = juju.Secret("my-secret",
model_uuid=development["uuid"],
name="my_secret_name",
value={
"key1": "value1",
"key2": "value2",
},
info="This is the secret")
my_application = juju.Application("my-application", config={
"secret": my_secret.secret_id,
})
# Write-only secret value. The value is supplied via value_wo, which is never
# stored in Terraform state. Bumping value_wo_version triggers an update of the
# secret value. This requires Terraform >= 1.11 and pairs well with ephemeral
# resources/values.
my_wo_secret = juju.Secret("my-wo-secret",
model_uuid=development["uuid"],
name="my_wo_secret_name",
value_wo={
"key1": "value1",
"key2": "value2",
},
value_wo_version=1,
info="This is a write-only secret")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/juju/v2/juju"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
my_secret, err := juju.NewSecret(ctx, "my-secret", &juju.SecretArgs{
ModelUuid: pulumi.Any(development.Uuid),
Name: pulumi.String("my_secret_name"),
Value: pulumi.StringMap{
"key1": pulumi.String("value1"),
"key2": pulumi.String("value2"),
},
Info: pulumi.String("This is the secret"),
})
if err != nil {
return err
}
_, err = juju.NewApplication(ctx, "my-application", &juju.ApplicationArgs{
Config: pulumi.StringMap{
"secret": my_secret.SecretId,
},
})
if err != nil {
return err
}
// Write-only secret value. The value is supplied via value_wo, which is never
// stored in Terraform state. Bumping value_wo_version triggers an update of the
// secret value. This requires Terraform >= 1.11 and pairs well with ephemeral
// resources/values.
_, err = juju.NewSecret(ctx, "my-wo-secret", &juju.SecretArgs{
ModelUuid: pulumi.Any(development.Uuid),
Name: pulumi.String("my_wo_secret_name"),
ValueWo: pulumi.StringMap{
"key1": pulumi.String("value1"),
"key2": pulumi.String("value2"),
},
ValueWoVersion: pulumi.Float64(1),
Info: pulumi.String("This is a write-only secret"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Juju = Pulumi.Juju;
return await Deployment.RunAsync(() =>
{
var my_secret = new Juju.Secret("my-secret", new()
{
ModelUuid = development.Uuid,
Name = "my_secret_name",
Value =
{
{ "key1", "value1" },
{ "key2", "value2" },
},
Info = "This is the secret",
});
var my_application = new Juju.Application("my-application", new()
{
Config =
{
{ "secret", my_secret.SecretId },
},
});
// Write-only secret value. The value is supplied via value_wo, which is never
// stored in Terraform state. Bumping value_wo_version triggers an update of the
// secret value. This requires Terraform >= 1.11 and pairs well with ephemeral
// resources/values.
var my_wo_secret = new Juju.Secret("my-wo-secret", new()
{
ModelUuid = development.Uuid,
Name = "my_wo_secret_name",
ValueWo =
{
{ "key1", "value1" },
{ "key2", "value2" },
},
ValueWoVersion = 1,
Info = "This is a write-only secret",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.juju.Secret;
import com.pulumi.juju.SecretArgs;
import com.pulumi.juju.Application;
import com.pulumi.juju.ApplicationArgs;
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 my_secret = new Secret("my-secret", SecretArgs.builder()
.modelUuid(development.uuid())
.name("my_secret_name")
.value(Map.ofEntries(
Map.entry("key1", "value1"),
Map.entry("key2", "value2")
))
.info("This is the secret")
.build());
var my_application = new Application("my-application", ApplicationArgs.builder()
.config(Map.of("secret", my_secret.secretId()))
.build());
// Write-only secret value. The value is supplied via value_wo, which is never
// stored in Terraform state. Bumping value_wo_version triggers an update of the
// secret value. This requires Terraform >= 1.11 and pairs well with ephemeral
// resources/values.
var my_wo_secret = new Secret("my-wo-secret", SecretArgs.builder()
.modelUuid(development.uuid())
.name("my_wo_secret_name")
.valueWo(Map.ofEntries(
Map.entry("key1", "value1"),
Map.entry("key2", "value2")
))
.valueWoVersion(1.0)
.info("This is a write-only secret")
.build());
}
}
resources:
my-secret:
type: juju:Secret
properties:
modelUuid: ${development.uuid}
name: my_secret_name
value:
key1: value1
key2: value2
info: This is the secret
my-application:
type: juju:Application
properties:
config:
secret: ${["my-secret"].secretId}
# Write-only secret value. The value is supplied via value_wo, which is never
# stored in Terraform state. Bumping value_wo_version triggers an update of the
# secret value. This requires Terraform >= 1.11 and pairs well with ephemeral
# resources/values.
my-wo-secret:
type: juju:Secret
properties:
modelUuid: ${development.uuid}
name: my_wo_secret_name
valueWo:
key1: value1
key2: value2
valueWoVersion: 1
info: This is a write-only secret
Example coming soon!
Create Secret Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Secret(name: string, args: SecretArgs, opts?: CustomResourceOptions);@overload
def Secret(resource_name: str,
args: SecretArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Secret(resource_name: str,
opts: Optional[ResourceOptions] = None,
model_uuid: Optional[str] = None,
info: Optional[str] = None,
name: Optional[str] = None,
value: Optional[Mapping[str, str]] = None,
value_wo: Optional[Mapping[str, str]] = None,
value_wo_version: Optional[float] = None)func NewSecret(ctx *Context, name string, args SecretArgs, opts ...ResourceOption) (*Secret, error)public Secret(string name, SecretArgs args, CustomResourceOptions? opts = null)
public Secret(String name, SecretArgs args)
public Secret(String name, SecretArgs args, CustomResourceOptions options)
type: juju:Secret
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "juju_secret" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args SecretArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SecretArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SecretArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecretArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecretArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var secretResource = new Juju.Secret("secretResource", new()
{
ModelUuid = "string",
Info = "string",
Name = "string",
Value =
{
{ "string", "string" },
},
ValueWo =
{
{ "string", "string" },
},
ValueWoVersion = 0,
});
example, err := juju.NewSecret(ctx, "secretResource", &juju.SecretArgs{
ModelUuid: pulumi.String("string"),
Info: pulumi.String("string"),
Name: pulumi.String("string"),
Value: pulumi.StringMap{
"string": pulumi.String("string"),
},
ValueWo: pulumi.StringMap{
"string": pulumi.String("string"),
},
ValueWoVersion: pulumi.Float64(0),
})
resource "juju_secret" "secretResource" {
lifecycle {
create_before_destroy = true
}
model_uuid = "string"
info = "string"
name = "string"
value = {
"string" = "string"
}
value_wo = {
"string" = "string"
}
value_wo_version = 0
}
var secretResource = new Secret("secretResource", SecretArgs.builder()
.modelUuid("string")
.info("string")
.name("string")
.value(Map.of("string", "string"))
.valueWo(Map.of("string", "string"))
.valueWoVersion(0.0)
.build());
secret_resource = juju.Secret("secretResource",
model_uuid="string",
info="string",
name="string",
value={
"string": "string",
},
value_wo={
"string": "string",
},
value_wo_version=float(0))
const secretResource = new juju.Secret("secretResource", {
modelUuid: "string",
info: "string",
name: "string",
value: {
string: "string",
},
valueWo: {
string: "string",
},
valueWoVersion: 0,
});
type: juju:Secret
properties:
info: string
modelUuid: string
name: string
value:
string: string
valueWo:
string: string
valueWoVersion: 0
Secret Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Secret resource accepts the following input properties:
- model_
uuid string - info string
- The description of the secret.
- name string
- The name of the secret.
- value map(string)
- value_
wo map(string) - value_
wo_ numberversion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- model_
uuid str - info str
- The description of the secret.
- name str
- The name of the secret.
- value Mapping[str, str]
- value_
wo Mapping[str, str] - value_
wo_ floatversion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
Outputs
All input properties are implicitly available as output properties. Additionally, the Secret resource produces the following output properties:
- id string
- The provider-assigned unique ID for this managed resource.
- secret_
id string - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret_
uri string - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- id str
- The provider-assigned unique ID for this managed resource.
- secret_
id str - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret_
uri str - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
Look up Existing Secret Resource
Get an existing Secret resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SecretState, opts?: CustomResourceOptions): Secret@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
info: Optional[str] = None,
model_uuid: Optional[str] = None,
name: Optional[str] = None,
secret_id: Optional[str] = None,
secret_uri: Optional[str] = None,
value: Optional[Mapping[str, str]] = None,
value_wo: Optional[Mapping[str, str]] = None,
value_wo_version: Optional[float] = None) -> Secretfunc GetSecret(ctx *Context, name string, id IDInput, state *SecretState, opts ...ResourceOption) (*Secret, error)public static Secret Get(string name, Input<string> id, SecretState? state, CustomResourceOptions? opts = null)public static Secret get(String name, Output<String> id, SecretState state, CustomResourceOptions options)resources: _: type: juju:Secret get: id: ${id}import {
to = juju_secret.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Info string
- The description of the secret.
- Model
Uuid string - Name string
- The name of the secret.
- Secret
Id string - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- Secret
Uri string - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- Value Dictionary<string, string>
- Value
Wo Dictionary<string, string> - Value
Wo doubleVersion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- Info string
- The description of the secret.
- Model
Uuid string - Name string
- The name of the secret.
- Secret
Id string - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- Secret
Uri string - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- Value map[string]string
- Value
Wo map[string]string - Value
Wo float64Version - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- info string
- The description of the secret.
- model_
uuid string - name string
- The name of the secret.
- secret_
id string - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret_
uri string - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- value map(string)
- value_
wo map(string) - value_
wo_ numberversion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- info String
- The description of the secret.
- model
Uuid String - name String
- The name of the secret.
- secret
Id String - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret
Uri String - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- value Map<String,String>
- value
Wo Map<String,String> - value
Wo DoubleVersion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- info string
- The description of the secret.
- model
Uuid string - name string
- The name of the secret.
- secret
Id string - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret
Uri string - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- value {[key: string]: string}
- value
Wo {[key: string]: string} - value
Wo numberVersion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- info str
- The description of the secret.
- model_
uuid str - name str
- The name of the secret.
- secret_
id str - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret_
uri str - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- value Mapping[str, str]
- value_
wo Mapping[str, str] - value_
wo_ floatversion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
- info String
- The description of the secret.
- model
Uuid String - name String
- The name of the secret.
- secret
Id String - The ID of the secret. E.g. coj8mulh8b41e8nv6p90
- secret
Uri String - The URI of the secret. E.g. secret:coj8mulh8b41e8nv6p90
- value Map<String>
- value
Wo Map<String> - value
Wo NumberVersion - The version of value_wo. Increment this value to trigger an update of the write-only secret value.
Import
The pulumi import command can be used, for example:
Secrets can be imported by using the model and secret names.
$ pulumi import juju:index/secret:Secret secret-name testmodel:secret-name
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- juju juju/terraform-provider-juju
- License
- Notes
- This Pulumi package is based on the
jujuTerraform Provider.
published on Monday, Jul 27, 2026 by juju