1. Packages
  2. HashiCorp Vault
  3. API Docs
  4. secrets
  5. SyncGcpDestination
HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi

vault.secrets.SyncGcpDestination

Explore with Pulumi AI

vault logo
HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fs from "fs";
    import * as vault from "@pulumi/vault";
    
    const gcp = new vault.secrets.SyncGcpDestination("gcp", {
        projectId: "gcp-project-id",
        credentials: fs.readFileSync(_var.credentials_file, "utf8"),
        secretNameTemplate: "vault_{{ .MountAccessor | lowercase }}_{{ .SecretPath | lowercase }}",
        customTags: {
            foo: "bar",
        },
    });
    
    import pulumi
    import pulumi_vault as vault
    
    gcp = vault.secrets.SyncGcpDestination("gcp",
        project_id="gcp-project-id",
        credentials=(lambda path: open(path).read())(var["credentials_file"]),
        secret_name_template="vault_{{ .MountAccessor | lowercase }}_{{ .SecretPath | lowercase }}",
        custom_tags={
            "foo": "bar",
        })
    
    package main
    
    import (
    	"os"
    
    	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/secrets"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := secrets.NewSyncGcpDestination(ctx, "gcp", &secrets.SyncGcpDestinationArgs{
    			ProjectId:          pulumi.String("gcp-project-id"),
    			Credentials:        readFileOrPanic(_var.Credentials_file),
    			SecretNameTemplate: pulumi.String("vault_{{ .MountAccessor | lowercase }}_{{ .SecretPath | lowercase }}"),
    			CustomTags: pulumi.Map{
    				"foo": pulumi.Any("bar"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var gcp = new Vault.Secrets.SyncGcpDestination("gcp", new()
        {
            ProjectId = "gcp-project-id",
            Credentials = File.ReadAllText(@var.Credentials_file),
            SecretNameTemplate = "vault_{{ .MountAccessor | lowercase }}_{{ .SecretPath | lowercase }}",
            CustomTags = 
            {
                { "foo", "bar" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.secrets.SyncGcpDestination;
    import com.pulumi.vault.secrets.SyncGcpDestinationArgs;
    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 gcp = new SyncGcpDestination("gcp", SyncGcpDestinationArgs.builder()        
                .projectId("gcp-project-id")
                .credentials(Files.readString(Paths.get(var_.credentials_file())))
                .secretNameTemplate("vault_{{ .MountAccessor | lowercase }}_{{ .SecretPath | lowercase }}")
                .customTags(Map.of("foo", "bar"))
                .build());
    
        }
    }
    
    resources:
      gcp:
        type: vault:secrets:SyncGcpDestination
        properties:
          projectId: gcp-project-id
          credentials:
            fn::readFile: ${var.credentials_file}
          secretNameTemplate: vault_{{ .MountAccessor | lowercase }}_{{ .SecretPath | lowercase }}
          customTags:
            foo: bar
    

    Create SyncGcpDestination Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SyncGcpDestination(name: string, args?: SyncGcpDestinationArgs, opts?: CustomResourceOptions);
    @overload
    def SyncGcpDestination(resource_name: str,
                           args: Optional[SyncGcpDestinationArgs] = None,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def SyncGcpDestination(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           credentials: Optional[str] = None,
                           custom_tags: Optional[Mapping[str, Any]] = None,
                           granularity: Optional[str] = None,
                           name: Optional[str] = None,
                           namespace: Optional[str] = None,
                           project_id: Optional[str] = None,
                           secret_name_template: Optional[str] = None)
    func NewSyncGcpDestination(ctx *Context, name string, args *SyncGcpDestinationArgs, opts ...ResourceOption) (*SyncGcpDestination, error)
    public SyncGcpDestination(string name, SyncGcpDestinationArgs? args = null, CustomResourceOptions? opts = null)
    public SyncGcpDestination(String name, SyncGcpDestinationArgs args)
    public SyncGcpDestination(String name, SyncGcpDestinationArgs args, CustomResourceOptions options)
    
    type: vault:secrets:SyncGcpDestination
    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 SyncGcpDestinationArgs
    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 SyncGcpDestinationArgs
    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 SyncGcpDestinationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SyncGcpDestinationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SyncGcpDestinationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var syncGcpDestinationResource = new Vault.Secrets.SyncGcpDestination("syncGcpDestinationResource", new()
    {
        Credentials = "string",
        CustomTags = 
        {
            { "string", "any" },
        },
        Granularity = "string",
        Name = "string",
        Namespace = "string",
        ProjectId = "string",
        SecretNameTemplate = "string",
    });
    
    example, err := secrets.NewSyncGcpDestination(ctx, "syncGcpDestinationResource", &secrets.SyncGcpDestinationArgs{
    	Credentials: pulumi.String("string"),
    	CustomTags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	Granularity:        pulumi.String("string"),
    	Name:               pulumi.String("string"),
    	Namespace:          pulumi.String("string"),
    	ProjectId:          pulumi.String("string"),
    	SecretNameTemplate: pulumi.String("string"),
    })
    
    var syncGcpDestinationResource = new SyncGcpDestination("syncGcpDestinationResource", SyncGcpDestinationArgs.builder()        
        .credentials("string")
        .customTags(Map.of("string", "any"))
        .granularity("string")
        .name("string")
        .namespace("string")
        .projectId("string")
        .secretNameTemplate("string")
        .build());
    
    sync_gcp_destination_resource = vault.secrets.SyncGcpDestination("syncGcpDestinationResource",
        credentials="string",
        custom_tags={
            "string": "any",
        },
        granularity="string",
        name="string",
        namespace="string",
        project_id="string",
        secret_name_template="string")
    
    const syncGcpDestinationResource = new vault.secrets.SyncGcpDestination("syncGcpDestinationResource", {
        credentials: "string",
        customTags: {
            string: "any",
        },
        granularity: "string",
        name: "string",
        namespace: "string",
        projectId: "string",
        secretNameTemplate: "string",
    });
    
    type: vault:secrets:SyncGcpDestination
    properties:
        credentials: string
        customTags:
            string: any
        granularity: string
        name: string
        namespace: string
        projectId: string
        secretNameTemplate: string
    

    SyncGcpDestination Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The SyncGcpDestination resource accepts the following input properties:

    Credentials string
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    CustomTags Dictionary<string, object>
    Custom tags to set on the secret managed at the destination.
    Granularity string
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    Name string
    Unique name of the GCP destination.
    Namespace string
    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.
    ProjectId string
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    SecretNameTemplate string
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    Credentials string
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    CustomTags map[string]interface{}
    Custom tags to set on the secret managed at the destination.
    Granularity string
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    Name string
    Unique name of the GCP destination.
    Namespace string
    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.
    ProjectId string
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    SecretNameTemplate string
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    credentials String
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    customTags Map<String,Object>
    Custom tags to set on the secret managed at the destination.
    granularity String
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name String
    Unique name of the GCP destination.
    namespace String
    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.
    projectId String
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secretNameTemplate String
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    credentials string
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    customTags {[key: string]: any}
    Custom tags to set on the secret managed at the destination.
    granularity string
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name string
    Unique name of the GCP destination.
    namespace string
    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.
    projectId string
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secretNameTemplate string
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    credentials str
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    custom_tags Mapping[str, Any]
    Custom tags to set on the secret managed at the destination.
    granularity str
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name str
    Unique name of the GCP destination.
    namespace str
    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.
    project_id str
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secret_name_template str
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    credentials String
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    customTags Map<Any>
    Custom tags to set on the secret managed at the destination.
    granularity String
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name String
    Unique name of the GCP destination.
    namespace String
    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.
    projectId String
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secretNameTemplate String
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SyncGcpDestination resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Type string
    The type of the secrets destination (gcp-sm).
    Id string
    The provider-assigned unique ID for this managed resource.
    Type string
    The type of the secrets destination (gcp-sm).
    id String
    The provider-assigned unique ID for this managed resource.
    type String
    The type of the secrets destination (gcp-sm).
    id string
    The provider-assigned unique ID for this managed resource.
    type string
    The type of the secrets destination (gcp-sm).
    id str
    The provider-assigned unique ID for this managed resource.
    type str
    The type of the secrets destination (gcp-sm).
    id String
    The provider-assigned unique ID for this managed resource.
    type String
    The type of the secrets destination (gcp-sm).

    Look up Existing SyncGcpDestination Resource

    Get an existing SyncGcpDestination 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?: SyncGcpDestinationState, opts?: CustomResourceOptions): SyncGcpDestination
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            credentials: Optional[str] = None,
            custom_tags: Optional[Mapping[str, Any]] = None,
            granularity: Optional[str] = None,
            name: Optional[str] = None,
            namespace: Optional[str] = None,
            project_id: Optional[str] = None,
            secret_name_template: Optional[str] = None,
            type: Optional[str] = None) -> SyncGcpDestination
    func GetSyncGcpDestination(ctx *Context, name string, id IDInput, state *SyncGcpDestinationState, opts ...ResourceOption) (*SyncGcpDestination, error)
    public static SyncGcpDestination Get(string name, Input<string> id, SyncGcpDestinationState? state, CustomResourceOptions? opts = null)
    public static SyncGcpDestination get(String name, Output<String> id, SyncGcpDestinationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Credentials string
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    CustomTags Dictionary<string, object>
    Custom tags to set on the secret managed at the destination.
    Granularity string
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    Name string
    Unique name of the GCP destination.
    Namespace string
    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.
    ProjectId string
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    SecretNameTemplate string
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    Type string
    The type of the secrets destination (gcp-sm).
    Credentials string
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    CustomTags map[string]interface{}
    Custom tags to set on the secret managed at the destination.
    Granularity string
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    Name string
    Unique name of the GCP destination.
    Namespace string
    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.
    ProjectId string
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    SecretNameTemplate string
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    Type string
    The type of the secrets destination (gcp-sm).
    credentials String
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    customTags Map<String,Object>
    Custom tags to set on the secret managed at the destination.
    granularity String
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name String
    Unique name of the GCP destination.
    namespace String
    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.
    projectId String
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secretNameTemplate String
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    type String
    The type of the secrets destination (gcp-sm).
    credentials string
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    customTags {[key: string]: any}
    Custom tags to set on the secret managed at the destination.
    granularity string
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name string
    Unique name of the GCP destination.
    namespace string
    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.
    projectId string
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secretNameTemplate string
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    type string
    The type of the secrets destination (gcp-sm).
    credentials str
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    custom_tags Mapping[str, Any]
    Custom tags to set on the secret managed at the destination.
    granularity str
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name str
    Unique name of the GCP destination.
    namespace str
    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.
    project_id str
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secret_name_template str
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    type str
    The type of the secrets destination (gcp-sm).
    credentials String
    JSON-encoded credentials to use to connect to GCP. Can be omitted and directly provided to Vault using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
    customTags Map<Any>
    Custom tags to set on the secret managed at the destination.
    granularity String
    Determines what level of information is synced as a distinct resource at the destination. Supports secret-path and secret-key.
    name String
    Unique name of the GCP destination.
    namespace String
    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.
    projectId String
    The target project to manage secrets in. If set, overrides the project ID derived from the service account JSON credentials or application default credentials. The service account must be authorized to perform Secret Manager actions in the target project.
    secretNameTemplate String
    Template describing how to generate external secret names. Supports a subset of the Go Template syntax.
    type String
    The type of the secrets destination (gcp-sm).

    Import

    GCP Secrets sync destinations can be imported using the name, e.g.

    $ pulumi import vault:secrets/syncGcpDestination:SyncGcpDestination gcp gcp-dest
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Vault pulumi/pulumi-vault
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vault Terraform Provider.
    vault logo
    HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi