com.pulumi.vault.consul.kotlin.SecretBackend.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-vault-kotlin Show documentation
Show all versions of pulumi-vault-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.vault.consul.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [SecretBackend].
*/
@PulumiTagMarker
public class SecretBackendResourceBuilder internal constructor() {
public var name: String? = null
public var args: SecretBackendArgs = SecretBackendArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend SecretBackendArgsBuilder.() -> Unit) {
val builder = SecretBackendArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): SecretBackend {
val builtJavaResource = com.pulumi.vault.consul.SecretBackend(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SecretBackend(builtJavaResource)
}
}
/**
* ## Example Usage
* ### Creating a standard backend resource:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const test = new vault.consul.SecretBackend("test", {
* path: "consul",
* description: "Manages the Consul backend",
* address: "127.0.0.1:8500",
* token: "4240861b-ce3d-8530-115a-521ff070dd29",
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* test = vault.consul.SecretBackend("test",
* path="consul",
* description="Manages the Consul backend",
* address="127.0.0.1:8500",
* token="4240861b-ce3d-8530-115a-521ff070dd29")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var test = new Vault.Consul.SecretBackend("test", new()
* {
* Path = "consul",
* Description = "Manages the Consul backend",
* Address = "127.0.0.1:8500",
* Token = "4240861b-ce3d-8530-115a-521ff070dd29",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-vault/sdk/v6/go/vault/consul"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := consul.NewSecretBackend(ctx, "test", &consul.SecretBackendArgs{
* Path: pulumi.String("consul"),
* Description: pulumi.String("Manages the Consul backend"),
* Address: pulumi.String("127.0.0.1:8500"),
* Token: pulumi.String("4240861b-ce3d-8530-115a-521ff070dd29"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.vault.consul.SecretBackend;
* import com.pulumi.vault.consul.SecretBackendArgs;
* 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 test = new SecretBackend("test", SecretBackendArgs.builder()
* .path("consul")
* .description("Manages the Consul backend")
* .address("127.0.0.1:8500")
* .token("4240861b-ce3d-8530-115a-521ff070dd29")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* test:
* type: vault:consul:SecretBackend
* properties:
* path: consul
* description: Manages the Consul backend
* address: 127.0.0.1:8500
* token: 4240861b-ce3d-8530-115a-521ff070dd29
* ```
*
* ### Creating a backend resource to bootstrap a new Consul instance:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
* const test = new vault.consul.SecretBackend("test", {
* path: "consul",
* description: "Bootstrap the Consul backend",
* address: "127.0.0.1:8500",
* bootstrap: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_vault as vault
* test = vault.consul.SecretBackend("test",
* path="consul",
* description="Bootstrap the Consul backend",
* address="127.0.0.1:8500",
* bootstrap=True)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Vault = Pulumi.Vault;
* return await Deployment.RunAsync(() =>
* {
* var test = new Vault.Consul.SecretBackend("test", new()
* {
* Path = "consul",
* Description = "Bootstrap the Consul backend",
* Address = "127.0.0.1:8500",
* Bootstrap = true,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-vault/sdk/v6/go/vault/consul"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := consul.NewSecretBackend(ctx, "test", &consul.SecretBackendArgs{
* Path: pulumi.String("consul"),
* Description: pulumi.String("Bootstrap the Consul backend"),
* Address: pulumi.String("127.0.0.1:8500"),
* Bootstrap: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.vault.consul.SecretBackend;
* import com.pulumi.vault.consul.SecretBackendArgs;
* 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 test = new SecretBackend("test", SecretBackendArgs.builder()
* .path("consul")
* .description("Bootstrap the Consul backend")
* .address("127.0.0.1:8500")
* .bootstrap(true)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* test:
* type: vault:consul:SecretBackend
* properties:
* path: consul
* description: Bootstrap the Consul backend
* address: 127.0.0.1:8500
* bootstrap: true
* ```
*
* ## Import
* Consul secret backends can be imported using the `path`, e.g.
* ```sh
* $ pulumi import vault:consul/secretBackend:SecretBackend example consul
* ```
*/
public class SecretBackend internal constructor(
override val javaResource: com.pulumi.vault.consul.SecretBackend,
) : KotlinCustomResource(javaResource, SecretBackendMapper) {
/**
* Specifies the address of the Consul instance, provided as "host:port" like "127.0.0.1:8500".
*/
public val address: Output
get() = javaResource.address().applyValue({ args0 -> args0 })
/**
* Denotes a backend resource that is used to bootstrap the Consul ACL system. Only one resource may be used to bootstrap.
*/
public val bootstrap: Output?
get() = javaResource.bootstrap().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* CA certificate to use when verifying Consul server certificate, must be x509 PEM encoded.
*/
public val caCert: Output?
get() = javaResource.caCert().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Client certificate used for Consul's TLS communication, must be x509 PEM encoded and if
* this is set you need to also set client_key.
*/
public val clientCert: Output?
get() = javaResource.clientCert().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Client key used for Consul's TLS communication, must be x509 PEM encoded and if this is set
* you need to also set client_cert.
*/
public val clientKey: Output?
get() = javaResource.clientKey().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The default TTL for credentials issued by this backend.
*/
public val defaultLeaseTtlSeconds: Output?
get() = javaResource.defaultLeaseTtlSeconds().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A human-friendly description for this backend.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* If set, opts out of mount migration on path updates.
* See here for more info on [Mount Migration](https://www.vaultproject.io/docs/concepts/mount-migration)
*/
public val disableRemount: Output?
get() = javaResource.disableRemount().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies if the secret backend is local only.
*/
public val local: Output?
get() = javaResource.local().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The maximum TTL that can be requested
* for credentials issued by this backend.
*/
public val maxLeaseTtlSeconds: Output?
get() = javaResource.maxLeaseTtlSeconds().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The namespace to provision the resource in.
* The value should not contain leading or trailing forward slashes.
* The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
* *Available only for Vault Enterprise*.
*/
public val namespace: Output?
get() = javaResource.namespace().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The unique location this backend should be mounted at. Must not begin or end with a `/`. Defaults
* to `consul`.
*/
public val path: Output?
get() = javaResource.path().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Specifies the URL scheme to use. Defaults to `http`.
*/
public val scheme: Output?
get() = javaResource.scheme().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Specifies the Consul token to use when managing or issuing new tokens.
*/
public val token: Output?
get() = javaResource.token().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object SecretBackendMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.vault.consul.SecretBackend::class == javaResource::class
override fun map(javaResource: Resource): SecretBackend = SecretBackend(
javaResource as
com.pulumi.vault.consul.SecretBackend,
)
}
/**
* @see [SecretBackend].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SecretBackend].
*/
public suspend fun secretBackend(
name: String,
block: suspend SecretBackendResourceBuilder.() -> Unit,
): SecretBackend {
val builder = SecretBackendResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SecretBackend].
* @param name The _unique_ name of the resulting resource.
*/
public fun secretBackend(name: String): SecretBackend {
val builder = SecretBackendResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy