1. Packages
  2. Ibm Provider
  3. API Docs
  4. IamServiceApiKey
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.IamServiceApiKey

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Create, update, or delete an IAM service API key by using resource group and resource type.For more information, about IAM service API key, see managing IAM acces, API keys.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const serviceID = new ibm.IamServiceId("serviceID", {});
    const testaccApiKey = new ibm.IamServiceApiKey("testaccApiKey", {iamServiceId: serviceID.iamId});
    
    import pulumi
    import pulumi_ibm as ibm
    
    service_id = ibm.IamServiceId("serviceID")
    testacc_api_key = ibm.IamServiceApiKey("testaccApiKey", iam_service_id=service_id.iam_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		serviceID, err := ibm.NewIamServiceId(ctx, "serviceID", nil)
    		if err != nil {
    			return err
    		}
    		_, err = ibm.NewIamServiceApiKey(ctx, "testaccApiKey", &ibm.IamServiceApiKeyArgs{
    			IamServiceId: serviceID.IamId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var serviceID = new Ibm.IamServiceId("serviceID");
    
        var testaccApiKey = new Ibm.IamServiceApiKey("testaccApiKey", new()
        {
            IamServiceId = serviceID.IamId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IamServiceId;
    import com.pulumi.ibm.IamServiceApiKey;
    import com.pulumi.ibm.IamServiceApiKeyArgs;
    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 serviceID = new IamServiceId("serviceID");
    
            var testaccApiKey = new IamServiceApiKey("testaccApiKey", IamServiceApiKeyArgs.builder()
                .iamServiceId(serviceID.iamId())
                .build());
    
        }
    }
    
    resources:
      serviceID:
        type: ibm:IamServiceId
      testaccApiKey:
        type: ibm:IamServiceApiKey
        properties:
          iamServiceId: ${serviceID.iamId}
    

    Create IamServiceApiKey Resource

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

    Constructor syntax

    new IamServiceApiKey(name: string, args: IamServiceApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def IamServiceApiKey(resource_name: str,
                         args: IamServiceApiKeyArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def IamServiceApiKey(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         iam_service_id: Optional[str] = None,
                         apikey: Optional[str] = None,
                         description: Optional[str] = None,
                         file: Optional[str] = None,
                         iam_service_api_key_id: Optional[str] = None,
                         locked: Optional[bool] = None,
                         name: Optional[str] = None,
                         store_value: Optional[bool] = None)
    func NewIamServiceApiKey(ctx *Context, name string, args IamServiceApiKeyArgs, opts ...ResourceOption) (*IamServiceApiKey, error)
    public IamServiceApiKey(string name, IamServiceApiKeyArgs args, CustomResourceOptions? opts = null)
    public IamServiceApiKey(String name, IamServiceApiKeyArgs args)
    public IamServiceApiKey(String name, IamServiceApiKeyArgs args, CustomResourceOptions options)
    
    type: ibm:IamServiceApiKey
    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 IamServiceApiKeyArgs
    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 IamServiceApiKeyArgs
    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 IamServiceApiKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IamServiceApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IamServiceApiKeyArgs
    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 iamServiceApiKeyResource = new Ibm.IamServiceApiKey("iamServiceApiKeyResource", new()
    {
        IamServiceId = "string",
        Apikey = "string",
        Description = "string",
        File = "string",
        IamServiceApiKeyId = "string",
        Locked = false,
        Name = "string",
        StoreValue = false,
    });
    
    example, err := ibm.NewIamServiceApiKey(ctx, "iamServiceApiKeyResource", &ibm.IamServiceApiKeyArgs{
    	IamServiceId:       pulumi.String("string"),
    	Apikey:             pulumi.String("string"),
    	Description:        pulumi.String("string"),
    	File:               pulumi.String("string"),
    	IamServiceApiKeyId: pulumi.String("string"),
    	Locked:             pulumi.Bool(false),
    	Name:               pulumi.String("string"),
    	StoreValue:         pulumi.Bool(false),
    })
    
    var iamServiceApiKeyResource = new IamServiceApiKey("iamServiceApiKeyResource", IamServiceApiKeyArgs.builder()
        .iamServiceId("string")
        .apikey("string")
        .description("string")
        .file("string")
        .iamServiceApiKeyId("string")
        .locked(false)
        .name("string")
        .storeValue(false)
        .build());
    
    iam_service_api_key_resource = ibm.IamServiceApiKey("iamServiceApiKeyResource",
        iam_service_id="string",
        apikey="string",
        description="string",
        file="string",
        iam_service_api_key_id="string",
        locked=False,
        name="string",
        store_value=False)
    
    const iamServiceApiKeyResource = new ibm.IamServiceApiKey("iamServiceApiKeyResource", {
        iamServiceId: "string",
        apikey: "string",
        description: "string",
        file: "string",
        iamServiceApiKeyId: "string",
        locked: false,
        name: "string",
        storeValue: false,
    });
    
    type: ibm:IamServiceApiKey
    properties:
        apikey: string
        description: string
        file: string
        iamServiceApiKeyId: string
        iamServiceId: string
        locked: false
        name: string
        storeValue: false
    

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

    IamServiceId string
    The IAM ID of the service.
    Apikey string
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    Description string
    The description of the service API key.
    File string
    The file name where API key is to be stored.
    IamServiceApiKeyId string
    (String) The unique identifier of the API key.
    Locked bool
    The API key cannot be changed if set to true.
    Name string
    The name of the service API key.
    StoreValue bool
    The boolean value whether API key value is retrievable in the future.
    IamServiceId string
    The IAM ID of the service.
    Apikey string
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    Description string
    The description of the service API key.
    File string
    The file name where API key is to be stored.
    IamServiceApiKeyId string
    (String) The unique identifier of the API key.
    Locked bool
    The API key cannot be changed if set to true.
    Name string
    The name of the service API key.
    StoreValue bool
    The boolean value whether API key value is retrievable in the future.
    iamServiceId String
    The IAM ID of the service.
    apikey String
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    description String
    The description of the service API key.
    file String
    The file name where API key is to be stored.
    iamServiceApiKeyId String
    (String) The unique identifier of the API key.
    locked Boolean
    The API key cannot be changed if set to true.
    name String
    The name of the service API key.
    storeValue Boolean
    The boolean value whether API key value is retrievable in the future.
    iamServiceId string
    The IAM ID of the service.
    apikey string
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    description string
    The description of the service API key.
    file string
    The file name where API key is to be stored.
    iamServiceApiKeyId string
    (String) The unique identifier of the API key.
    locked boolean
    The API key cannot be changed if set to true.
    name string
    The name of the service API key.
    storeValue boolean
    The boolean value whether API key value is retrievable in the future.
    iam_service_id str
    The IAM ID of the service.
    apikey str
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    description str
    The description of the service API key.
    file str
    The file name where API key is to be stored.
    iam_service_api_key_id str
    (String) The unique identifier of the API key.
    locked bool
    The API key cannot be changed if set to true.
    name str
    The name of the service API key.
    store_value bool
    The boolean value whether API key value is retrievable in the future.
    iamServiceId String
    The IAM ID of the service.
    apikey String
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    description String
    The description of the service API key.
    file String
    The file name where API key is to be stored.
    iamServiceApiKeyId String
    (String) The unique identifier of the API key.
    locked Boolean
    The API key cannot be changed if set to true.
    name String
    The name of the service API key.
    storeValue Boolean
    The boolean value whether API key value is retrievable in the future.

    Outputs

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

    AccountId string
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    CreatedAt string
    (Timestamp) The date and time service API key was created.
    CreatedBy string
    (String) The IAM ID of the service that is created by the API key.
    Crn string
    (String) The CRN of the service API key.
    EntityTag string
    Version of the API Key details object
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedAt string
    (String) The date and time service API key was modified.
    AccountId string
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    CreatedAt string
    (Timestamp) The date and time service API key was created.
    CreatedBy string
    (String) The IAM ID of the service that is created by the API key.
    Crn string
    (String) The CRN of the service API key.
    EntityTag string
    Version of the API Key details object
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedAt string
    (String) The date and time service API key was modified.
    accountId String
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    createdAt String
    (Timestamp) The date and time service API key was created.
    createdBy String
    (String) The IAM ID of the service that is created by the API key.
    crn String
    (String) The CRN of the service API key.
    entityTag String
    Version of the API Key details object
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedAt String
    (String) The date and time service API key was modified.
    accountId string
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    createdAt string
    (Timestamp) The date and time service API key was created.
    createdBy string
    (String) The IAM ID of the service that is created by the API key.
    crn string
    (String) The CRN of the service API key.
    entityTag string
    Version of the API Key details object
    id string
    The provider-assigned unique ID for this managed resource.
    modifiedAt string
    (String) The date and time service API key was modified.
    account_id str
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    created_at str
    (Timestamp) The date and time service API key was created.
    created_by str
    (String) The IAM ID of the service that is created by the API key.
    crn str
    (String) The CRN of the service API key.
    entity_tag str
    Version of the API Key details object
    id str
    The provider-assigned unique ID for this managed resource.
    modified_at str
    (String) The date and time service API key was modified.
    accountId String
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    createdAt String
    (Timestamp) The date and time service API key was created.
    createdBy String
    (String) The IAM ID of the service that is created by the API key.
    crn String
    (String) The CRN of the service API key.
    entityTag String
    Version of the API Key details object
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedAt String
    (String) The date and time service API key was modified.

    Look up Existing IamServiceApiKey Resource

    Get an existing IamServiceApiKey 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?: IamServiceApiKeyState, opts?: CustomResourceOptions): IamServiceApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            apikey: Optional[str] = None,
            created_at: Optional[str] = None,
            created_by: Optional[str] = None,
            crn: Optional[str] = None,
            description: Optional[str] = None,
            entity_tag: Optional[str] = None,
            file: Optional[str] = None,
            iam_service_api_key_id: Optional[str] = None,
            iam_service_id: Optional[str] = None,
            locked: Optional[bool] = None,
            modified_at: Optional[str] = None,
            name: Optional[str] = None,
            store_value: Optional[bool] = None) -> IamServiceApiKey
    func GetIamServiceApiKey(ctx *Context, name string, id IDInput, state *IamServiceApiKeyState, opts ...ResourceOption) (*IamServiceApiKey, error)
    public static IamServiceApiKey Get(string name, Input<string> id, IamServiceApiKeyState? state, CustomResourceOptions? opts = null)
    public static IamServiceApiKey get(String name, Output<String> id, IamServiceApiKeyState state, CustomResourceOptions options)
    resources:  _:    type: ibm:IamServiceApiKey    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.
    The following state arguments are supported:
    AccountId string
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    Apikey string
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    CreatedAt string
    (Timestamp) The date and time service API key was created.
    CreatedBy string
    (String) The IAM ID of the service that is created by the API key.
    Crn string
    (String) The CRN of the service API key.
    Description string
    The description of the service API key.
    EntityTag string
    Version of the API Key details object
    File string
    The file name where API key is to be stored.
    IamServiceApiKeyId string
    (String) The unique identifier of the API key.
    IamServiceId string
    The IAM ID of the service.
    Locked bool
    The API key cannot be changed if set to true.
    ModifiedAt string
    (String) The date and time service API key was modified.
    Name string
    The name of the service API key.
    StoreValue bool
    The boolean value whether API key value is retrievable in the future.
    AccountId string
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    Apikey string
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    CreatedAt string
    (Timestamp) The date and time service API key was created.
    CreatedBy string
    (String) The IAM ID of the service that is created by the API key.
    Crn string
    (String) The CRN of the service API key.
    Description string
    The description of the service API key.
    EntityTag string
    Version of the API Key details object
    File string
    The file name where API key is to be stored.
    IamServiceApiKeyId string
    (String) The unique identifier of the API key.
    IamServiceId string
    The IAM ID of the service.
    Locked bool
    The API key cannot be changed if set to true.
    ModifiedAt string
    (String) The date and time service API key was modified.
    Name string
    The name of the service API key.
    StoreValue bool
    The boolean value whether API key value is retrievable in the future.
    accountId String
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    apikey String
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    createdAt String
    (Timestamp) The date and time service API key was created.
    createdBy String
    (String) The IAM ID of the service that is created by the API key.
    crn String
    (String) The CRN of the service API key.
    description String
    The description of the service API key.
    entityTag String
    Version of the API Key details object
    file String
    The file name where API key is to be stored.
    iamServiceApiKeyId String
    (String) The unique identifier of the API key.
    iamServiceId String
    The IAM ID of the service.
    locked Boolean
    The API key cannot be changed if set to true.
    modifiedAt String
    (String) The date and time service API key was modified.
    name String
    The name of the service API key.
    storeValue Boolean
    The boolean value whether API key value is retrievable in the future.
    accountId string
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    apikey string
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    createdAt string
    (Timestamp) The date and time service API key was created.
    createdBy string
    (String) The IAM ID of the service that is created by the API key.
    crn string
    (String) The CRN of the service API key.
    description string
    The description of the service API key.
    entityTag string
    Version of the API Key details object
    file string
    The file name where API key is to be stored.
    iamServiceApiKeyId string
    (String) The unique identifier of the API key.
    iamServiceId string
    The IAM ID of the service.
    locked boolean
    The API key cannot be changed if set to true.
    modifiedAt string
    (String) The date and time service API key was modified.
    name string
    The name of the service API key.
    storeValue boolean
    The boolean value whether API key value is retrievable in the future.
    account_id str
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    apikey str
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    created_at str
    (Timestamp) The date and time service API key was created.
    created_by str
    (String) The IAM ID of the service that is created by the API key.
    crn str
    (String) The CRN of the service API key.
    description str
    The description of the service API key.
    entity_tag str
    Version of the API Key details object
    file str
    The file name where API key is to be stored.
    iam_service_api_key_id str
    (String) The unique identifier of the API key.
    iam_service_id str
    The IAM ID of the service.
    locked bool
    The API key cannot be changed if set to true.
    modified_at str
    (String) The date and time service API key was modified.
    name str
    The name of the service API key.
    store_value bool
    The boolean value whether API key value is retrievable in the future.
    accountId String
    (String) The account Id of the API key.

    • entity_tag - (String) The version or entity tag of the service API key.
    apikey String
    The API key value. This property only contains the API key value for the following cases: create an API key, update a Service API key that stores the API key value as retrievable, or get a service API key that stores the API key value as retrievable. All other operations do not return the API key value. For example, all user API key related operations, except for create, do not contain the API key value.
    createdAt String
    (Timestamp) The date and time service API key was created.
    createdBy String
    (String) The IAM ID of the service that is created by the API key.
    crn String
    (String) The CRN of the service API key.
    description String
    The description of the service API key.
    entityTag String
    Version of the API Key details object
    file String
    The file name where API key is to be stored.
    iamServiceApiKeyId String
    (String) The unique identifier of the API key.
    iamServiceId String
    The IAM ID of the service.
    locked Boolean
    The API key cannot be changed if set to true.
    modifiedAt String
    (String) The date and time service API key was modified.
    name String
    The name of the service API key.
    storeValue Boolean
    The boolean value whether API key value is retrievable in the future.

    Import

    The ibm_iam_service_api_key resource can be imported by using service API Key.

    Syntax

    $ pulumi import ibm:index/iamServiceApiKey:IamServiceApiKey testacc_apiKey <service API key>
    

    Example

    $ pulumi import ibm:index/iamServiceApiKey:IamServiceApiKey testacc_apiKey ApiKey-9d12342134f-41c2-a541-7b0be37c3da0
    

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

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud