1. Packages
  2. OVH
  3. API Docs
  4. Okms
  5. Credential
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

ovh.Okms.Credential

Explore with Pulumi AI

ovh logo
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

    Creates a credential for an OVHcloud KMS.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fs from "fs";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    import * as ovh from "@pulumi/ovh";
    
    const myaccount = ovh.Me.getMe({});
    const credNoCsr = new ovh.okms.Credential("credNoCsr", {
        okmsId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        identityUrns: [`urn:v1:eu:identity:account:${data.ovh_me.current_account.nichandle}`],
        description: "Credential without CSR",
    });
    const credFromCsr = new ovh.okms.Credential("credFromCsr", {
        okmsId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        identityUrns: [`urn:v1:eu:identity:account:${data.ovh_me.current_account.nichandle}`],
        csr: fs.readFileSync("cred.csr", "utf8"),
        description: "Credential from CSR",
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    myaccount = ovh.Me.get_me()
    cred_no_csr = ovh.okms.Credential("credNoCsr",
        okms_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        identity_urns=[f"urn:v1:eu:identity:account:{data['ovh_me']['current_account']['nichandle']}"],
        description="Credential without CSR")
    cred_from_csr = ovh.okms.Credential("credFromCsr",
        okms_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        identity_urns=[f"urn:v1:eu:identity:account:{data['ovh_me']['current_account']['nichandle']}"],
        csr=(lambda path: open(path).read())("cred.csr"),
        description="Credential from CSR")
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/Me"
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/Okms"
    	"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 := Me.GetMe(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = Okms.NewCredential(ctx, "credNoCsr", &Okms.CredentialArgs{
    			OkmsId: pulumi.String("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
    			IdentityUrns: pulumi.StringArray{
    				pulumi.Sprintf("urn:v1:eu:identity:account:%v", data.Ovh_me.Current_account.Nichandle),
    			},
    			Description: pulumi.String("Credential without CSR"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = Okms.NewCredential(ctx, "credFromCsr", &Okms.CredentialArgs{
    			OkmsId: pulumi.String("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
    			IdentityUrns: pulumi.StringArray{
    				pulumi.Sprintf("urn:v1:eu:identity:account:%v", data.Ovh_me.Current_account.Nichandle),
    			},
    			Csr:         pulumi.String(readFileOrPanic("cred.csr")),
    			Description: pulumi.String("Credential from CSR"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var myaccount = Ovh.Me.GetMe.Invoke();
    
        var credNoCsr = new Ovh.Okms.Credential("credNoCsr", new()
        {
            OkmsId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            IdentityUrns = new[]
            {
                $"urn:v1:eu:identity:account:{data.Ovh_me.Current_account.Nichandle}",
            },
            Description = "Credential without CSR",
        });
    
        var credFromCsr = new Ovh.Okms.Credential("credFromCsr", new()
        {
            OkmsId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            IdentityUrns = new[]
            {
                $"urn:v1:eu:identity:account:{data.Ovh_me.Current_account.Nichandle}",
            },
            Csr = File.ReadAllText("cred.csr"),
            Description = "Credential from CSR",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.Me.MeFunctions;
    import com.pulumi.ovh.Okms.Credential;
    import com.pulumi.ovh.Okms.CredentialArgs;
    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) {
            final var myaccount = MeFunctions.getMe();
    
            var credNoCsr = new Credential("credNoCsr", CredentialArgs.builder()
                .okmsId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
                .identityUrns(String.format("urn:v1:eu:identity:account:%s", data.ovh_me().current_account().nichandle()))
                .description("Credential without CSR")
                .build());
    
            var credFromCsr = new Credential("credFromCsr", CredentialArgs.builder()
                .okmsId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
                .identityUrns(String.format("urn:v1:eu:identity:account:%s", data.ovh_me().current_account().nichandle()))
                .csr(Files.readString(Paths.get("cred.csr")))
                .description("Credential from CSR")
                .build());
    
        }
    }
    
    resources:
      credNoCsr:
        type: ovh:Okms:Credential
        properties:
          okmsId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
          identityUrns:
            - urn:v1:eu:identity:account:${data.ovh_me.current_account.nichandle}
          description: Credential without CSR
      credFromCsr:
        type: ovh:Okms:Credential
        properties:
          okmsId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
          identityUrns:
            - urn:v1:eu:identity:account:${data.ovh_me.current_account.nichandle}
          csr:
            fn::readFile: cred.csr
          description: Credential from CSR
    variables:
      myaccount:
        fn::invoke:
          Function: ovh:Me:getMe
          Arguments: {}
    

    Create Credential Resource

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

    Constructor syntax

    new Credential(name: string, args: CredentialArgs, opts?: CustomResourceOptions);
    @overload
    def Credential(resource_name: str,
                   args: CredentialArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def Credential(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   identity_urns: Optional[Sequence[str]] = None,
                   okms_id: Optional[str] = None,
                   csr: Optional[str] = None,
                   description: Optional[str] = None,
                   name: Optional[str] = None,
                   validity: Optional[float] = None)
    func NewCredential(ctx *Context, name string, args CredentialArgs, opts ...ResourceOption) (*Credential, error)
    public Credential(string name, CredentialArgs args, CustomResourceOptions? opts = null)
    public Credential(String name, CredentialArgs args)
    public Credential(String name, CredentialArgs args, CustomResourceOptions options)
    
    type: ovh:Okms:Credential
    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 CredentialArgs
    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 CredentialArgs
    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 CredentialArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CredentialArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CredentialArgs
    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 credentialResource = new Ovh.Okms.Credential("credentialResource", new()
    {
        IdentityUrns = new[]
        {
            "string",
        },
        OkmsId = "string",
        Csr = "string",
        Description = "string",
        Name = "string",
        Validity = 0,
    });
    
    example, err := Okms.NewCredential(ctx, "credentialResource", &Okms.CredentialArgs{
    	IdentityUrns: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	OkmsId:      pulumi.String("string"),
    	Csr:         pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	Validity:    pulumi.Float64(0),
    })
    
    var credentialResource = new Credential("credentialResource", CredentialArgs.builder()
        .identityUrns("string")
        .okmsId("string")
        .csr("string")
        .description("string")
        .name("string")
        .validity(0)
        .build());
    
    credential_resource = ovh.okms.Credential("credentialResource",
        identity_urns=["string"],
        okms_id="string",
        csr="string",
        description="string",
        name="string",
        validity=0)
    
    const credentialResource = new ovh.okms.Credential("credentialResource", {
        identityUrns: ["string"],
        okmsId: "string",
        csr: "string",
        description: "string",
        name: "string",
        validity: 0,
    });
    
    type: ovh:Okms:Credential
    properties:
        csr: string
        description: string
        identityUrns:
            - string
        name: string
        okmsId: string
        validity: 0
    

    Credential 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 Credential resource accepts the following input properties:

    IdentityUrns List<string>
    List of identity URNs associated with the credential (max 25)
    OkmsId string
    Okms ID
    Csr string
    Valid Certificate Signing Request
    Description string
    Description of the credential (max 200)
    Name string
    Name of the credential (max 50)
    Validity double
    Validity in days (default 365, max 365)
    IdentityUrns []string
    List of identity URNs associated with the credential (max 25)
    OkmsId string
    Okms ID
    Csr string
    Valid Certificate Signing Request
    Description string
    Description of the credential (max 200)
    Name string
    Name of the credential (max 50)
    Validity float64
    Validity in days (default 365, max 365)
    identityUrns List<String>
    List of identity URNs associated with the credential (max 25)
    okmsId String
    Okms ID
    csr String
    Valid Certificate Signing Request
    description String
    Description of the credential (max 200)
    name String
    Name of the credential (max 50)
    validity Double
    Validity in days (default 365, max 365)
    identityUrns string[]
    List of identity URNs associated with the credential (max 25)
    okmsId string
    Okms ID
    csr string
    Valid Certificate Signing Request
    description string
    Description of the credential (max 200)
    name string
    Name of the credential (max 50)
    validity number
    Validity in days (default 365, max 365)
    identity_urns Sequence[str]
    List of identity URNs associated with the credential (max 25)
    okms_id str
    Okms ID
    csr str
    Valid Certificate Signing Request
    description str
    Description of the credential (max 200)
    name str
    Name of the credential (max 50)
    validity float
    Validity in days (default 365, max 365)
    identityUrns List<String>
    List of identity URNs associated with the credential (max 25)
    okmsId String
    Okms ID
    csr String
    Valid Certificate Signing Request
    description String
    Description of the credential (max 200)
    name String
    Name of the credential (max 50)
    validity Number
    Validity in days (default 365, max 365)

    Outputs

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

    CertificatePem string
    (String) Certificate PEM of the credential.
    CreatedAt string
    (String) Creation time of the credential
    ExpiredAt string
    (String) Expiration time of the credential
    FromCsr bool
    (Boolean) Whether the credential was generated from a CSR
    Id string
    The provider-assigned unique ID for this managed resource.
    PrivateKeyPem string
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    Status string
    (String) Status of the credential
    CertificatePem string
    (String) Certificate PEM of the credential.
    CreatedAt string
    (String) Creation time of the credential
    ExpiredAt string
    (String) Expiration time of the credential
    FromCsr bool
    (Boolean) Whether the credential was generated from a CSR
    Id string
    The provider-assigned unique ID for this managed resource.
    PrivateKeyPem string
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    Status string
    (String) Status of the credential
    certificatePem String
    (String) Certificate PEM of the credential.
    createdAt String
    (String) Creation time of the credential
    expiredAt String
    (String) Expiration time of the credential
    fromCsr Boolean
    (Boolean) Whether the credential was generated from a CSR
    id String
    The provider-assigned unique ID for this managed resource.
    privateKeyPem String
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status String
    (String) Status of the credential
    certificatePem string
    (String) Certificate PEM of the credential.
    createdAt string
    (String) Creation time of the credential
    expiredAt string
    (String) Expiration time of the credential
    fromCsr boolean
    (Boolean) Whether the credential was generated from a CSR
    id string
    The provider-assigned unique ID for this managed resource.
    privateKeyPem string
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status string
    (String) Status of the credential
    certificate_pem str
    (String) Certificate PEM of the credential.
    created_at str
    (String) Creation time of the credential
    expired_at str
    (String) Expiration time of the credential
    from_csr bool
    (Boolean) Whether the credential was generated from a CSR
    id str
    The provider-assigned unique ID for this managed resource.
    private_key_pem str
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status str
    (String) Status of the credential
    certificatePem String
    (String) Certificate PEM of the credential.
    createdAt String
    (String) Creation time of the credential
    expiredAt String
    (String) Expiration time of the credential
    fromCsr Boolean
    (Boolean) Whether the credential was generated from a CSR
    id String
    The provider-assigned unique ID for this managed resource.
    privateKeyPem String
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status String
    (String) Status of the credential

    Look up Existing Credential Resource

    Get an existing Credential 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?: CredentialState, opts?: CustomResourceOptions): Credential
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            certificate_pem: Optional[str] = None,
            created_at: Optional[str] = None,
            csr: Optional[str] = None,
            description: Optional[str] = None,
            expired_at: Optional[str] = None,
            from_csr: Optional[bool] = None,
            identity_urns: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            okms_id: Optional[str] = None,
            private_key_pem: Optional[str] = None,
            status: Optional[str] = None,
            validity: Optional[float] = None) -> Credential
    func GetCredential(ctx *Context, name string, id IDInput, state *CredentialState, opts ...ResourceOption) (*Credential, error)
    public static Credential Get(string name, Input<string> id, CredentialState? state, CustomResourceOptions? opts = null)
    public static Credential get(String name, Output<String> id, CredentialState 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:
    CertificatePem string
    (String) Certificate PEM of the credential.
    CreatedAt string
    (String) Creation time of the credential
    Csr string
    Valid Certificate Signing Request
    Description string
    Description of the credential (max 200)
    ExpiredAt string
    (String) Expiration time of the credential
    FromCsr bool
    (Boolean) Whether the credential was generated from a CSR
    IdentityUrns List<string>
    List of identity URNs associated with the credential (max 25)
    Name string
    Name of the credential (max 50)
    OkmsId string
    Okms ID
    PrivateKeyPem string
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    Status string
    (String) Status of the credential
    Validity double
    Validity in days (default 365, max 365)
    CertificatePem string
    (String) Certificate PEM of the credential.
    CreatedAt string
    (String) Creation time of the credential
    Csr string
    Valid Certificate Signing Request
    Description string
    Description of the credential (max 200)
    ExpiredAt string
    (String) Expiration time of the credential
    FromCsr bool
    (Boolean) Whether the credential was generated from a CSR
    IdentityUrns []string
    List of identity URNs associated with the credential (max 25)
    Name string
    Name of the credential (max 50)
    OkmsId string
    Okms ID
    PrivateKeyPem string
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    Status string
    (String) Status of the credential
    Validity float64
    Validity in days (default 365, max 365)
    certificatePem String
    (String) Certificate PEM of the credential.
    createdAt String
    (String) Creation time of the credential
    csr String
    Valid Certificate Signing Request
    description String
    Description of the credential (max 200)
    expiredAt String
    (String) Expiration time of the credential
    fromCsr Boolean
    (Boolean) Whether the credential was generated from a CSR
    identityUrns List<String>
    List of identity URNs associated with the credential (max 25)
    name String
    Name of the credential (max 50)
    okmsId String
    Okms ID
    privateKeyPem String
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status String
    (String) Status of the credential
    validity Double
    Validity in days (default 365, max 365)
    certificatePem string
    (String) Certificate PEM of the credential.
    createdAt string
    (String) Creation time of the credential
    csr string
    Valid Certificate Signing Request
    description string
    Description of the credential (max 200)
    expiredAt string
    (String) Expiration time of the credential
    fromCsr boolean
    (Boolean) Whether the credential was generated from a CSR
    identityUrns string[]
    List of identity URNs associated with the credential (max 25)
    name string
    Name of the credential (max 50)
    okmsId string
    Okms ID
    privateKeyPem string
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status string
    (String) Status of the credential
    validity number
    Validity in days (default 365, max 365)
    certificate_pem str
    (String) Certificate PEM of the credential.
    created_at str
    (String) Creation time of the credential
    csr str
    Valid Certificate Signing Request
    description str
    Description of the credential (max 200)
    expired_at str
    (String) Expiration time of the credential
    from_csr bool
    (Boolean) Whether the credential was generated from a CSR
    identity_urns Sequence[str]
    List of identity URNs associated with the credential (max 25)
    name str
    Name of the credential (max 50)
    okms_id str
    Okms ID
    private_key_pem str
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status str
    (String) Status of the credential
    validity float
    Validity in days (default 365, max 365)
    certificatePem String
    (String) Certificate PEM of the credential.
    createdAt String
    (String) Creation time of the credential
    csr String
    Valid Certificate Signing Request
    description String
    Description of the credential (max 200)
    expiredAt String
    (String) Expiration time of the credential
    fromCsr Boolean
    (Boolean) Whether the credential was generated from a CSR
    identityUrns List<String>
    List of identity URNs associated with the credential (max 25)
    name String
    Name of the credential (max 50)
    okmsId String
    Okms ID
    privateKeyPem String
    (String, Sensitive) Private Key PEM of the credential if no CSR is provided
    status String
    (String) Status of the credential
    validity Number
    Validity in days (default 365, max 365)

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud