1. Packages
  2. Scaleway
  3. API Docs
  4. IamApiKey
Scaleway v1.26.0 published on Friday, Mar 28, 2025 by pulumiverse

scaleway.IamApiKey

Explore with Pulumi AI

Deprecated: scaleway.index/iamapikey.IamApiKey has been deprecated in favor of scaleway.iam/apikey.ApiKey

Creates and manages Scaleway API Keys. For more information, refer to the IAM API documentation.

Example Usage

With application

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";

const ciCd = new scaleway.iam.Application("ci_cd", {name: "My application"});
const main = new scaleway.iam.ApiKey("main", {
    applicationId: mainScalewayIamApplication.id,
    description: "a description",
});
Copy
import pulumi
import pulumiverse_scaleway as scaleway

ci_cd = scaleway.iam.Application("ci_cd", name="My application")
main = scaleway.iam.ApiKey("main",
    application_id=main_scaleway_iam_application["id"],
    description="a description")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/iam"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iam.NewApplication(ctx, "ci_cd", &iam.ApplicationArgs{
			Name: pulumi.String("My application"),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewApiKey(ctx, "main", &iam.ApiKeyArgs{
			ApplicationId: pulumi.Any(mainScalewayIamApplication.Id),
			Description:   pulumi.String("a description"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;

return await Deployment.RunAsync(() => 
{
    var ciCd = new Scaleway.Iam.Application("ci_cd", new()
    {
        Name = "My application",
    });

    var main = new Scaleway.Iam.ApiKey("main", new()
    {
        ApplicationId = mainScalewayIamApplication.Id,
        Description = "a description",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.iam.Application;
import com.pulumi.scaleway.iam.ApplicationArgs;
import com.pulumi.scaleway.iam.ApiKey;
import com.pulumi.scaleway.iam.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 ciCd = new Application("ciCd", ApplicationArgs.builder()
            .name("My application")
            .build());

        var main = new ApiKey("main", ApiKeyArgs.builder()
            .applicationId(mainScalewayIamApplication.id())
            .description("a description")
            .build());

    }
}
Copy
resources:
  ciCd:
    type: scaleway:iam:Application
    name: ci_cd
    properties:
      name: My application
  main:
    type: scaleway:iam:ApiKey
    properties:
      applicationId: ${mainScalewayIamApplication.id}
      description: a description
Copy

With user

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";

const main = new scaleway.iam.User("main", {email: "test@test.com"});
const mainApiKey = new scaleway.iam.ApiKey("main", {
    userId: main.id,
    description: "a description",
});
Copy
import pulumi
import pulumiverse_scaleway as scaleway

main = scaleway.iam.User("main", email="test@test.com")
main_api_key = scaleway.iam.ApiKey("main",
    user_id=main.id,
    description="a description")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/iam"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		main, err := iam.NewUser(ctx, "main", &iam.UserArgs{
			Email: pulumi.String("test@test.com"),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewApiKey(ctx, "main", &iam.ApiKeyArgs{
			UserId:      main.ID(),
			Description: pulumi.String("a description"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;

return await Deployment.RunAsync(() => 
{
    var main = new Scaleway.Iam.User("main", new()
    {
        Email = "test@test.com",
    });

    var mainApiKey = new Scaleway.Iam.ApiKey("main", new()
    {
        UserId = main.Id,
        Description = "a description",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.iam.User;
import com.pulumi.scaleway.iam.UserArgs;
import com.pulumi.scaleway.iam.ApiKey;
import com.pulumi.scaleway.iam.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 main = new User("main", UserArgs.builder()
            .email("test@test.com")
            .build());

        var mainApiKey = new ApiKey("mainApiKey", ApiKeyArgs.builder()
            .userId(main.id())
            .description("a description")
            .build());

    }
}
Copy
resources:
  main:
    type: scaleway:iam:User
    properties:
      email: test@test.com
  mainApiKey:
    type: scaleway:iam:ApiKey
    name: main
    properties:
      userId: ${main.id}
      description: a description
Copy

With expiration

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
import * as time from "@pulumi/time";

const rotateAfterAYear = new time.index.Rotating("rotate_after_a_year", {rotationYears: 1});
const main = new scaleway.iam.ApiKey("main", {
    applicationId: mainScalewayIamApplication.id,
    expiresAt: rotateAfterAYear.rotationRfc3339,
});
Copy
import pulumi
import pulumi_time as time
import pulumiverse_scaleway as scaleway

rotate_after_a_year = time.index.Rotating("rotate_after_a_year", rotation_years=1)
main = scaleway.iam.ApiKey("main",
    application_id=main_scaleway_iam_application["id"],
    expires_at=rotate_after_a_year["rotationRfc3339"])
Copy
package main

import (
	"github.com/pulumi/pulumi-time/sdk/go/time"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/iam"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		rotateAfterAYear, err := time.NewRotating(ctx, "rotate_after_a_year", &time.RotatingArgs{
			RotationYears: 1,
		})
		if err != nil {
			return err
		}
		_, err = iam.NewApiKey(ctx, "main", &iam.ApiKeyArgs{
			ApplicationId: pulumi.Any(mainScalewayIamApplication.Id),
			ExpiresAt:     rotateAfterAYear.RotationRfc3339,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;
using Time = Pulumi.Time;

return await Deployment.RunAsync(() => 
{
    var rotateAfterAYear = new Time.Index.Rotating("rotate_after_a_year", new()
    {
        RotationYears = 1,
    });

    var main = new Scaleway.Iam.ApiKey("main", new()
    {
        ApplicationId = mainScalewayIamApplication.Id,
        ExpiresAt = rotateAfterAYear.RotationRfc3339,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.time.rotating;
import com.pulumi.time.RotatingArgs;
import com.pulumi.scaleway.iam.ApiKey;
import com.pulumi.scaleway.iam.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 rotateAfterAYear = new Rotating("rotateAfterAYear", RotatingArgs.builder()
            .rotationYears(1)
            .build());

        var main = new ApiKey("main", ApiKeyArgs.builder()
            .applicationId(mainScalewayIamApplication.id())
            .expiresAt(rotateAfterAYear.rotationRfc3339())
            .build());

    }
}
Copy
resources:
  rotateAfterAYear:
    type: time:rotating
    name: rotate_after_a_year
    properties:
      rotationYears: 1
  main:
    type: scaleway:iam:ApiKey
    properties:
      applicationId: ${mainScalewayIamApplication.id}
      expiresAt: ${rotateAfterAYear.rotationRfc3339}
Copy

Create IamApiKey Resource

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

Constructor syntax

new IamApiKey(name: string, args?: IamApiKeyArgs, opts?: CustomResourceOptions);
@overload
def IamApiKey(resource_name: str,
              args: Optional[IamApiKeyArgs] = None,
              opts: Optional[ResourceOptions] = None)

@overload
def IamApiKey(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              application_id: Optional[str] = None,
              default_project_id: Optional[str] = None,
              description: Optional[str] = None,
              expires_at: Optional[str] = None,
              user_id: Optional[str] = None)
func NewIamApiKey(ctx *Context, name string, args *IamApiKeyArgs, opts ...ResourceOption) (*IamApiKey, error)
public IamApiKey(string name, IamApiKeyArgs? args = null, CustomResourceOptions? opts = null)
public IamApiKey(String name, IamApiKeyArgs args)
public IamApiKey(String name, IamApiKeyArgs args, CustomResourceOptions options)
type: scaleway:IamApiKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args IamApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args IamApiKeyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args IamApiKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args IamApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. IamApiKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

ApplicationId Changes to this property will trigger replacement. string
ID of the application attached to the API key.
DefaultProjectId Changes to this property will trigger replacement. string
The default Project ID to use with Object Storage.
Description string
The description of the API key.
ExpiresAt Changes to this property will trigger replacement. string
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
UserId string

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

ApplicationId Changes to this property will trigger replacement. string
ID of the application attached to the API key.
DefaultProjectId Changes to this property will trigger replacement. string
The default Project ID to use with Object Storage.
Description string
The description of the API key.
ExpiresAt Changes to this property will trigger replacement. string
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
UserId string

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

applicationId Changes to this property will trigger replacement. String
ID of the application attached to the API key.
defaultProjectId Changes to this property will trigger replacement. String
The default Project ID to use with Object Storage.
description String
The description of the API key.
expiresAt Changes to this property will trigger replacement. String
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
userId String

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

applicationId Changes to this property will trigger replacement. string
ID of the application attached to the API key.
defaultProjectId Changes to this property will trigger replacement. string
The default Project ID to use with Object Storage.
description string
The description of the API key.
expiresAt Changes to this property will trigger replacement. string
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
userId string

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

application_id Changes to this property will trigger replacement. str
ID of the application attached to the API key.
default_project_id Changes to this property will trigger replacement. str
The default Project ID to use with Object Storage.
description str
The description of the API key.
expires_at Changes to this property will trigger replacement. str
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
user_id str

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

applicationId Changes to this property will trigger replacement. String
ID of the application attached to the API key.
defaultProjectId Changes to this property will trigger replacement. String
The default Project ID to use with Object Storage.
description String
The description of the API key.
expiresAt Changes to this property will trigger replacement. String
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
userId String

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

Outputs

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

AccessKey string
The access key of the IAM API key.
CreatedAt string
The date and time of the creation of the IAM API key.
CreationIp string
The IP Address of the device which created the API key.
Editable bool
Whether the IAM API key is editable.
Id string
The provider-assigned unique ID for this managed resource.
SecretKey string
The secret Key of the IAM API key.
UpdatedAt string
The date and time of the last update of the IAM API key.
AccessKey string
The access key of the IAM API key.
CreatedAt string
The date and time of the creation of the IAM API key.
CreationIp string
The IP Address of the device which created the API key.
Editable bool
Whether the IAM API key is editable.
Id string
The provider-assigned unique ID for this managed resource.
SecretKey string
The secret Key of the IAM API key.
UpdatedAt string
The date and time of the last update of the IAM API key.
accessKey String
The access key of the IAM API key.
createdAt String
The date and time of the creation of the IAM API key.
creationIp String
The IP Address of the device which created the API key.
editable Boolean
Whether the IAM API key is editable.
id String
The provider-assigned unique ID for this managed resource.
secretKey String
The secret Key of the IAM API key.
updatedAt String
The date and time of the last update of the IAM API key.
accessKey string
The access key of the IAM API key.
createdAt string
The date and time of the creation of the IAM API key.
creationIp string
The IP Address of the device which created the API key.
editable boolean
Whether the IAM API key is editable.
id string
The provider-assigned unique ID for this managed resource.
secretKey string
The secret Key of the IAM API key.
updatedAt string
The date and time of the last update of the IAM API key.
access_key str
The access key of the IAM API key.
created_at str
The date and time of the creation of the IAM API key.
creation_ip str
The IP Address of the device which created the API key.
editable bool
Whether the IAM API key is editable.
id str
The provider-assigned unique ID for this managed resource.
secret_key str
The secret Key of the IAM API key.
updated_at str
The date and time of the last update of the IAM API key.
accessKey String
The access key of the IAM API key.
createdAt String
The date and time of the creation of the IAM API key.
creationIp String
The IP Address of the device which created the API key.
editable Boolean
Whether the IAM API key is editable.
id String
The provider-assigned unique ID for this managed resource.
secretKey String
The secret Key of the IAM API key.
updatedAt String
The date and time of the last update of the IAM API key.

Look up Existing IamApiKey Resource

Get an existing IamApiKey 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?: IamApiKeyState, opts?: CustomResourceOptions): IamApiKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_key: Optional[str] = None,
        application_id: Optional[str] = None,
        created_at: Optional[str] = None,
        creation_ip: Optional[str] = None,
        default_project_id: Optional[str] = None,
        description: Optional[str] = None,
        editable: Optional[bool] = None,
        expires_at: Optional[str] = None,
        secret_key: Optional[str] = None,
        updated_at: Optional[str] = None,
        user_id: Optional[str] = None) -> IamApiKey
func GetIamApiKey(ctx *Context, name string, id IDInput, state *IamApiKeyState, opts ...ResourceOption) (*IamApiKey, error)
public static IamApiKey Get(string name, Input<string> id, IamApiKeyState? state, CustomResourceOptions? opts = null)
public static IamApiKey get(String name, Output<String> id, IamApiKeyState state, CustomResourceOptions options)
resources:  _:    type: scaleway:IamApiKey    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccessKey string
The access key of the IAM API key.
ApplicationId Changes to this property will trigger replacement. string
ID of the application attached to the API key.
CreatedAt string
The date and time of the creation of the IAM API key.
CreationIp string
The IP Address of the device which created the API key.
DefaultProjectId Changes to this property will trigger replacement. string
The default Project ID to use with Object Storage.
Description string
The description of the API key.
Editable bool
Whether the IAM API key is editable.
ExpiresAt Changes to this property will trigger replacement. string
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
SecretKey string
The secret Key of the IAM API key.
UpdatedAt string
The date and time of the last update of the IAM API key.
UserId string

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

AccessKey string
The access key of the IAM API key.
ApplicationId Changes to this property will trigger replacement. string
ID of the application attached to the API key.
CreatedAt string
The date and time of the creation of the IAM API key.
CreationIp string
The IP Address of the device which created the API key.
DefaultProjectId Changes to this property will trigger replacement. string
The default Project ID to use with Object Storage.
Description string
The description of the API key.
Editable bool
Whether the IAM API key is editable.
ExpiresAt Changes to this property will trigger replacement. string
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
SecretKey string
The secret Key of the IAM API key.
UpdatedAt string
The date and time of the last update of the IAM API key.
UserId string

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

accessKey String
The access key of the IAM API key.
applicationId Changes to this property will trigger replacement. String
ID of the application attached to the API key.
createdAt String
The date and time of the creation of the IAM API key.
creationIp String
The IP Address of the device which created the API key.
defaultProjectId Changes to this property will trigger replacement. String
The default Project ID to use with Object Storage.
description String
The description of the API key.
editable Boolean
Whether the IAM API key is editable.
expiresAt Changes to this property will trigger replacement. String
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
secretKey String
The secret Key of the IAM API key.
updatedAt String
The date and time of the last update of the IAM API key.
userId String

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

accessKey string
The access key of the IAM API key.
applicationId Changes to this property will trigger replacement. string
ID of the application attached to the API key.
createdAt string
The date and time of the creation of the IAM API key.
creationIp string
The IP Address of the device which created the API key.
defaultProjectId Changes to this property will trigger replacement. string
The default Project ID to use with Object Storage.
description string
The description of the API key.
editable boolean
Whether the IAM API key is editable.
expiresAt Changes to this property will trigger replacement. string
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
secretKey string
The secret Key of the IAM API key.
updatedAt string
The date and time of the last update of the IAM API key.
userId string

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

access_key str
The access key of the IAM API key.
application_id Changes to this property will trigger replacement. str
ID of the application attached to the API key.
created_at str
The date and time of the creation of the IAM API key.
creation_ip str
The IP Address of the device which created the API key.
default_project_id Changes to this property will trigger replacement. str
The default Project ID to use with Object Storage.
description str
The description of the API key.
editable bool
Whether the IAM API key is editable.
expires_at Changes to this property will trigger replacement. str
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
secret_key str
The secret Key of the IAM API key.
updated_at str
The date and time of the last update of the IAM API key.
user_id str

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

accessKey String
The access key of the IAM API key.
applicationId Changes to this property will trigger replacement. String
ID of the application attached to the API key.
createdAt String
The date and time of the creation of the IAM API key.
creationIp String
The IP Address of the device which created the API key.
defaultProjectId Changes to this property will trigger replacement. String
The default Project ID to use with Object Storage.
description String
The description of the API key.
editable Boolean
Whether the IAM API key is editable.
expiresAt Changes to this property will trigger replacement. String
The date and time of the expiration of the IAM API key. Please note that in case of any changes, the resource will be recreated.
secretKey String
The secret Key of the IAM API key.
updatedAt String
The date and time of the last update of the IAM API key.
userId String

ID of the user attached to the API key.

Note You must specify at least one: application_id and/or user_id.

Import

Api keys can be imported using the {id}, e.g.

bash

$ pulumi import scaleway:index/iamApiKey:IamApiKey main 11111111111111111111
Copy

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

Package Details

Repository
scaleway pulumiverse/pulumi-scaleway
License
Apache-2.0
Notes
This Pulumi package is based on the scaleway Terraform Provider.