juju.Secret
Explore with Pulumi AI
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", {
model: juju_model.development.name,
value: {
key1: "value1",
key2: "value2",
},
info: "This is the secret",
});
const my_application = new juju.Application("my-application", {config: {
secret: my_secret.secretId,
}});
//
import pulumi
import pulumi_juju as juju
my_secret = juju.Secret("my-secret",
model=juju_model["development"]["name"],
value={
"key1": "value1",
"key2": "value2",
},
info="This is the secret")
my_application = juju.Application("my-application", config={
"secret": my_secret.secret_id,
})
#
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/juju/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{
Model: pulumi.Any(juju_model.Development.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
}
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()
{
Model = juju_model.Development.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 },
},
});
//
});
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()
.model(juju_model.development().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());
//
}
}
resources:
my-secret:
type: juju:Secret
properties:
model: ${juju_model.development.name}
value:
key1: value1
key2: value2
info: This is the secret
my-application:
type: juju:Application
properties:
#
config:
secret: ${["my-secret"].secretId}
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: Optional[str] = None,
value: Optional[Mapping[str, str]] = None,
info: Optional[str] = None,
name: Optional[str] = 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.
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()
{
Model = "string",
Value =
{
{ "string", "string" },
},
Info = "string",
Name = "string",
});
example, err := juju.NewSecret(ctx, "secretResource", &juju.SecretArgs{
Model: pulumi.String("string"),
Value: pulumi.StringMap{
"string": pulumi.String("string"),
},
Info: pulumi.String("string"),
Name: pulumi.String("string"),
})
var secretResource = new Secret("secretResource", SecretArgs.builder()
.model("string")
.value(Map.of("string", "string"))
.info("string")
.name("string")
.build());
secret_resource = juju.Secret("secretResource",
model="string",
value={
"string": "string",
},
info="string",
name="string")
const secretResource = new juju.Secret("secretResource", {
model: "string",
value: {
string: "string",
},
info: "string",
name: "string",
});
type: juju:Secret
properties:
info: string
model: string
name: string
value:
string: string
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:
Outputs
All input properties are implicitly available as output properties. Additionally, the Secret resource produces the following output properties:
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: Optional[str] = None,
name: Optional[str] = None,
secret_id: Optional[str] = None,
value: Optional[Mapping[str, str]] = None) -> Secret
func 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}
- 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.
Import
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
juju
Terraform Provider.