1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. ApiKey
Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi

oci.Identity.ApiKey

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi

    This resource provides the Api Key resource in Oracle Cloud Infrastructure Identity service.

    Uploads an API signing key for the specified user.

    Every user has permission to use this operation to upload a key for their own user ID. An administrator in your organization does not need to write a policy to give users this ability. To compare, administrators who have permission to the tenancy can use this operation to upload a key for any user, including themselves.

    Important: Even though you have permission to upload an API key, you might not yet have permission to do much else. If you try calling an operation unrelated to your own credential management (e.g., ListUsers, LaunchInstance) and receive an “unauthorized” error, check with an administrator to confirm which IAM Service group(s) you’re in and what access you have. Also confirm you’re working in the correct compartment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testApiKey = new oci.identity.ApiKey("test_api_key", {
        keyValue: apiKeyKeyValue,
        userId: testUser.id,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_api_key = oci.identity.ApiKey("test_api_key",
        key_value=api_key_key_value,
        user_id=test_user["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/Identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Identity.NewApiKey(ctx, "test_api_key", &Identity.ApiKeyArgs{
    			KeyValue: pulumi.Any(apiKeyKeyValue),
    			UserId:   pulumi.Any(testUser.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testApiKey = new Oci.Identity.ApiKey("test_api_key", new()
        {
            KeyValue = apiKeyKeyValue,
            UserId = testUser.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Identity.ApiKey;
    import com.pulumi.oci.Identity.ApiKeyArgs;
    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 testApiKey = new ApiKey("testApiKey", ApiKeyArgs.builder()
                .keyValue(apiKeyKeyValue)
                .userId(testUser.id())
                .build());
    
        }
    }
    
    resources:
      testApiKey:
        type: oci:Identity:ApiKey
        name: test_api_key
        properties:
          keyValue: ${apiKeyKeyValue}
          userId: ${testUser.id}
    

    Create ApiKey Resource

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

    Constructor syntax

    new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def ApiKey(resource_name: str,
               args: ApiKeyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               key_value: Optional[str] = None,
               user_id: Optional[str] = None)
    func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
    public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)
    public ApiKey(String name, ApiKeyArgs args)
    public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
    
    type: oci:Identity:ApiKey
    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 ApiKeyArgs
    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 ApiKeyArgs
    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 ApiKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiKeyArgs
    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 apiKeyResource = new Oci.Identity.ApiKey("apiKeyResource", new()
    {
        KeyValue = "string",
        UserId = "string",
    });
    
    example, err := Identity.NewApiKey(ctx, "apiKeyResource", &Identity.ApiKeyArgs{
    	KeyValue: pulumi.String("string"),
    	UserId:   pulumi.String("string"),
    })
    
    var apiKeyResource = new ApiKey("apiKeyResource", ApiKeyArgs.builder()
        .keyValue("string")
        .userId("string")
        .build());
    
    api_key_resource = oci.identity.ApiKey("apiKeyResource",
        key_value="string",
        user_id="string")
    
    const apiKeyResource = new oci.identity.ApiKey("apiKeyResource", {
        keyValue: "string",
        userId: "string",
    });
    
    type: oci:Identity:ApiKey
    properties:
        keyValue: string
        userId: string
    

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

    KeyValue string
    The public key. Must be an RSA key in PEM format.
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    KeyValue string
    The public key. Must be an RSA key in PEM format.
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    keyValue String
    The public key. Must be an RSA key in PEM format.
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    keyValue string
    The public key. Must be an RSA key in PEM format.
    userId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    key_value str
    The public key. Must be an RSA key in PEM format.
    user_id str

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    keyValue String
    The public key. Must be an RSA key in PEM format.
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Outputs

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

    Fingerprint string
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    Id string
    The provider-assigned unique ID for this managed resource.
    InactiveStatus string
    The detailed status of INACTIVE lifecycleState.
    State string
    The API key's current state.
    TimeCreated string
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    Fingerprint string
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    Id string
    The provider-assigned unique ID for this managed resource.
    InactiveStatus string
    The detailed status of INACTIVE lifecycleState.
    State string
    The API key's current state.
    TimeCreated string
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    fingerprint String
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    id String
    The provider-assigned unique ID for this managed resource.
    inactiveStatus String
    The detailed status of INACTIVE lifecycleState.
    state String
    The API key's current state.
    timeCreated String
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    fingerprint string
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    id string
    The provider-assigned unique ID for this managed resource.
    inactiveStatus string
    The detailed status of INACTIVE lifecycleState.
    state string
    The API key's current state.
    timeCreated string
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    fingerprint str
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    id str
    The provider-assigned unique ID for this managed resource.
    inactive_status str
    The detailed status of INACTIVE lifecycleState.
    state str
    The API key's current state.
    time_created str
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    fingerprint String
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    id String
    The provider-assigned unique ID for this managed resource.
    inactiveStatus String
    The detailed status of INACTIVE lifecycleState.
    state String
    The API key's current state.
    timeCreated String
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

    Look up Existing ApiKey Resource

    Get an existing ApiKey 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?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            fingerprint: Optional[str] = None,
            inactive_status: Optional[str] = None,
            key_value: Optional[str] = None,
            state: Optional[str] = None,
            time_created: Optional[str] = None,
            user_id: Optional[str] = None) -> ApiKey
    func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
    public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
    public static ApiKey get(String name, Output<String> id, ApiKeyState 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:
    Fingerprint string
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    InactiveStatus string
    The detailed status of INACTIVE lifecycleState.
    KeyValue string
    The public key. Must be an RSA key in PEM format.
    State string
    The API key's current state.
    TimeCreated string
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Fingerprint string
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    InactiveStatus string
    The detailed status of INACTIVE lifecycleState.
    KeyValue string
    The public key. Must be an RSA key in PEM format.
    State string
    The API key's current state.
    TimeCreated string
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    fingerprint String
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    inactiveStatus String
    The detailed status of INACTIVE lifecycleState.
    keyValue String
    The public key. Must be an RSA key in PEM format.
    state String
    The API key's current state.
    timeCreated String
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    fingerprint string
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    inactiveStatus string
    The detailed status of INACTIVE lifecycleState.
    keyValue string
    The public key. Must be an RSA key in PEM format.
    state string
    The API key's current state.
    timeCreated string
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    userId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    fingerprint str
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    inactive_status str
    The detailed status of INACTIVE lifecycleState.
    key_value str
    The public key. Must be an RSA key in PEM format.
    state str
    The API key's current state.
    time_created str
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    user_id str

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    fingerprint String
    The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
    inactiveStatus String
    The detailed status of INACTIVE lifecycleState.
    keyValue String
    The public key. Must be an RSA key in PEM format.
    state String
    The API key's current state.
    timeCreated String
    Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Import

    ApiKeys can be imported using the id, e.g.

    $ pulumi import oci:Identity/apiKey:ApiKey test_api_key "users/{userId}/apiKeys/{fingerprint}"
    

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

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi