1. Packages
  2. Scaleway
  3. API Docs
  4. IamPolicy
Scaleway v1.10.0 published on Saturday, Jul 1, 2023 by lbrlabs

scaleway.IamPolicy

Explore with Pulumi AI

scaleway logo
Scaleway v1.10.0 published on Saturday, Jul 1, 2023 by lbrlabs

    Creates and manages Scaleway IAM Policies. For more information, see the documentation.

    Example Usage

    Create a policy for an organization's project

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Lbrlabs.PulumiPackage.Scaleway;
    using Scaleway = Pulumi.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = Scaleway.GetAccountProject.Invoke(new()
        {
            Name = "default",
        });
    
        var app = new Scaleway.IamApplication("app");
    
        var objectReadOnly = new Scaleway.IamPolicy("objectReadOnly", new()
        {
            Description = "gives app readonly access to object storage in project",
            ApplicationId = app.Id,
            Rules = new[]
            {
                new Scaleway.Inputs.IamPolicyRuleArgs
                {
                    ProjectIds = new[]
                    {
                        @default.Apply(@default => @default.Apply(getAccountProjectResult => getAccountProjectResult.Id)),
                    },
                    PermissionSetNames = new[]
                    {
                        "ObjectStorageReadOnly",
                    },
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-scaleway/sdk/go/scaleway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := scaleway.LookupAccountProject(ctx, &scaleway.LookupAccountProjectArgs{
    			Name: pulumi.StringRef("default"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		app, err := scaleway.NewIamApplication(ctx, "app", nil)
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewIamPolicy(ctx, "objectReadOnly", &scaleway.IamPolicyArgs{
    			Description:   pulumi.String("gives app readonly access to object storage in project"),
    			ApplicationId: app.ID(),
    			Rules: scaleway.IamPolicyRuleArray{
    				&scaleway.IamPolicyRuleArgs{
    					ProjectIds: pulumi.StringArray{
    						*pulumi.String(_default.Id),
    					},
    					PermissionSetNames: pulumi.StringArray{
    						pulumi.String("ObjectStorageReadOnly"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.ScalewayFunctions;
    import com.pulumi.scaleway.inputs.GetAccountProjectArgs;
    import com.pulumi.scaleway.IamApplication;
    import com.pulumi.scaleway.IamPolicy;
    import com.pulumi.scaleway.IamPolicyArgs;
    import com.pulumi.scaleway.inputs.IamPolicyRuleArgs;
    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 default = ScalewayFunctions.getAccountProject(GetAccountProjectArgs.builder()
                .name("default")
                .build());
    
            var app = new IamApplication("app");
    
            var objectReadOnly = new IamPolicy("objectReadOnly", IamPolicyArgs.builder()        
                .description("gives app readonly access to object storage in project")
                .applicationId(app.id())
                .rules(IamPolicyRuleArgs.builder()
                    .projectIds(default_.id())
                    .permissionSetNames("ObjectStorageReadOnly")
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_scaleway as scaleway
    import pulumi_scaleway as scaleway
    
    default = scaleway.get_account_project(name="default")
    app = scaleway.IamApplication("app")
    object_read_only = scaleway.IamPolicy("objectReadOnly",
        description="gives app readonly access to object storage in project",
        application_id=app.id,
        rules=[scaleway.IamPolicyRuleArgs(
            project_ids=[default.id],
            permission_set_names=["ObjectStorageReadOnly"],
        )])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@lbrlabs/pulumi-scaleway";
    import * as scaleway from "@pulumi/scaleway";
    
    const default = scaleway.getAccountProject({
        name: "default",
    });
    const app = new scaleway.IamApplication("app", {});
    const objectReadOnly = new scaleway.IamPolicy("objectReadOnly", {
        description: "gives app readonly access to object storage in project",
        applicationId: app.id,
        rules: [{
            projectIds: [_default.then(_default => _default.id)],
            permissionSetNames: ["ObjectStorageReadOnly"],
        }],
    });
    
    resources:
      app:
        type: scaleway:IamApplication
      objectReadOnly:
        type: scaleway:IamPolicy
        properties:
          description: gives app readonly access to object storage in project
          applicationId: ${app.id}
          rules:
            - projectIds:
                - ${default.id}
              permissionSetNames:
                - ObjectStorageReadOnly
    variables:
      default:
        fn::invoke:
          Function: scaleway:getAccountProject
          Arguments:
            name: default
    

    Create IamPolicy Resource

    new IamPolicy(name: string, args: IamPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def IamPolicy(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  application_id: Optional[str] = None,
                  description: Optional[str] = None,
                  group_id: Optional[str] = None,
                  name: Optional[str] = None,
                  no_principal: Optional[bool] = None,
                  organization_id: Optional[str] = None,
                  rules: Optional[Sequence[IamPolicyRuleArgs]] = None,
                  user_id: Optional[str] = None)
    @overload
    def IamPolicy(resource_name: str,
                  args: IamPolicyArgs,
                  opts: Optional[ResourceOptions] = None)
    func NewIamPolicy(ctx *Context, name string, args IamPolicyArgs, opts ...ResourceOption) (*IamPolicy, error)
    public IamPolicy(string name, IamPolicyArgs args, CustomResourceOptions? opts = null)
    public IamPolicy(String name, IamPolicyArgs args)
    public IamPolicy(String name, IamPolicyArgs args, CustomResourceOptions options)
    
    type: scaleway:IamPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args IamPolicyArgs
    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 IamPolicyArgs
    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 IamPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IamPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IamPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Rules List<Lbrlabs.PulumiPackage.Scaleway.Inputs.IamPolicyRule>

    List of rules in the policy.

    ApplicationId string

    ID of the Application the policy will be linked to

    Description string

    The description of the iam policy.

    GroupId string

    ID of the Group the policy will be linked to

    Name string

    .The name of the iam policy.

    NoPrincipal bool

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    OrganizationId string

    ID of organization scoped to the rule.

    UserId string

    ID of the User the policy will be linked to

    Rules []IamPolicyRuleArgs

    List of rules in the policy.

    ApplicationId string

    ID of the Application the policy will be linked to

    Description string

    The description of the iam policy.

    GroupId string

    ID of the Group the policy will be linked to

    Name string

    .The name of the iam policy.

    NoPrincipal bool

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    OrganizationId string

    ID of organization scoped to the rule.

    UserId string

    ID of the User the policy will be linked to

    rules List<IamPolicyRule>

    List of rules in the policy.

    applicationId String

    ID of the Application the policy will be linked to

    description String

    The description of the iam policy.

    groupId String

    ID of the Group the policy will be linked to

    name String

    .The name of the iam policy.

    noPrincipal Boolean

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organizationId String

    ID of organization scoped to the rule.

    userId String

    ID of the User the policy will be linked to

    rules IamPolicyRule[]

    List of rules in the policy.

    applicationId string

    ID of the Application the policy will be linked to

    description string

    The description of the iam policy.

    groupId string

    ID of the Group the policy will be linked to

    name string

    .The name of the iam policy.

    noPrincipal boolean

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organizationId string

    ID of organization scoped to the rule.

    userId string

    ID of the User the policy will be linked to

    rules Sequence[IamPolicyRuleArgs]

    List of rules in the policy.

    application_id str

    ID of the Application the policy will be linked to

    description str

    The description of the iam policy.

    group_id str

    ID of the Group the policy will be linked to

    name str

    .The name of the iam policy.

    no_principal bool

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organization_id str

    ID of organization scoped to the rule.

    user_id str

    ID of the User the policy will be linked to

    rules List<Property Map>

    List of rules in the policy.

    applicationId String

    ID of the Application the policy will be linked to

    description String

    The description of the iam policy.

    groupId String

    ID of the Group the policy will be linked to

    name String

    .The name of the iam policy.

    noPrincipal Boolean

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organizationId String

    ID of organization scoped to the rule.

    userId String

    ID of the User the policy will be linked to

    Outputs

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

    CreatedAt string

    The date and time of the creation of the policy.

    Editable bool

    Whether the policy is editable.

    Id string

    The provider-assigned unique ID for this managed resource.

    UpdatedAt string

    The date and time of the last update of the policy.

    CreatedAt string

    The date and time of the creation of the policy.

    Editable bool

    Whether the policy is editable.

    Id string

    The provider-assigned unique ID for this managed resource.

    UpdatedAt string

    The date and time of the last update of the policy.

    createdAt String

    The date and time of the creation of the policy.

    editable Boolean

    Whether the policy is editable.

    id String

    The provider-assigned unique ID for this managed resource.

    updatedAt String

    The date and time of the last update of the policy.

    createdAt string

    The date and time of the creation of the policy.

    editable boolean

    Whether the policy is editable.

    id string

    The provider-assigned unique ID for this managed resource.

    updatedAt string

    The date and time of the last update of the policy.

    created_at str

    The date and time of the creation of the policy.

    editable bool

    Whether the policy is editable.

    id str

    The provider-assigned unique ID for this managed resource.

    updated_at str

    The date and time of the last update of the policy.

    createdAt String

    The date and time of the creation of the policy.

    editable Boolean

    Whether the policy is editable.

    id String

    The provider-assigned unique ID for this managed resource.

    updatedAt String

    The date and time of the last update of the policy.

    Look up Existing IamPolicy Resource

    Get an existing IamPolicy 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?: IamPolicyState, opts?: CustomResourceOptions): IamPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            application_id: Optional[str] = None,
            created_at: Optional[str] = None,
            description: Optional[str] = None,
            editable: Optional[bool] = None,
            group_id: Optional[str] = None,
            name: Optional[str] = None,
            no_principal: Optional[bool] = None,
            organization_id: Optional[str] = None,
            rules: Optional[Sequence[IamPolicyRuleArgs]] = None,
            updated_at: Optional[str] = None,
            user_id: Optional[str] = None) -> IamPolicy
    func GetIamPolicy(ctx *Context, name string, id IDInput, state *IamPolicyState, opts ...ResourceOption) (*IamPolicy, error)
    public static IamPolicy Get(string name, Input<string> id, IamPolicyState? state, CustomResourceOptions? opts = null)
    public static IamPolicy get(String name, Output<String> id, IamPolicyState 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:
    ApplicationId string

    ID of the Application the policy will be linked to

    CreatedAt string

    The date and time of the creation of the policy.

    Description string

    The description of the iam policy.

    Editable bool

    Whether the policy is editable.

    GroupId string

    ID of the Group the policy will be linked to

    Name string

    .The name of the iam policy.

    NoPrincipal bool

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    OrganizationId string

    ID of organization scoped to the rule.

    Rules List<Lbrlabs.PulumiPackage.Scaleway.Inputs.IamPolicyRule>

    List of rules in the policy.

    UpdatedAt string

    The date and time of the last update of the policy.

    UserId string

    ID of the User the policy will be linked to

    ApplicationId string

    ID of the Application the policy will be linked to

    CreatedAt string

    The date and time of the creation of the policy.

    Description string

    The description of the iam policy.

    Editable bool

    Whether the policy is editable.

    GroupId string

    ID of the Group the policy will be linked to

    Name string

    .The name of the iam policy.

    NoPrincipal bool

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    OrganizationId string

    ID of organization scoped to the rule.

    Rules []IamPolicyRuleArgs

    List of rules in the policy.

    UpdatedAt string

    The date and time of the last update of the policy.

    UserId string

    ID of the User the policy will be linked to

    applicationId String

    ID of the Application the policy will be linked to

    createdAt String

    The date and time of the creation of the policy.

    description String

    The description of the iam policy.

    editable Boolean

    Whether the policy is editable.

    groupId String

    ID of the Group the policy will be linked to

    name String

    .The name of the iam policy.

    noPrincipal Boolean

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organizationId String

    ID of organization scoped to the rule.

    rules List<IamPolicyRule>

    List of rules in the policy.

    updatedAt String

    The date and time of the last update of the policy.

    userId String

    ID of the User the policy will be linked to

    applicationId string

    ID of the Application the policy will be linked to

    createdAt string

    The date and time of the creation of the policy.

    description string

    The description of the iam policy.

    editable boolean

    Whether the policy is editable.

    groupId string

    ID of the Group the policy will be linked to

    name string

    .The name of the iam policy.

    noPrincipal boolean

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organizationId string

    ID of organization scoped to the rule.

    rules IamPolicyRule[]

    List of rules in the policy.

    updatedAt string

    The date and time of the last update of the policy.

    userId string

    ID of the User the policy will be linked to

    application_id str

    ID of the Application the policy will be linked to

    created_at str

    The date and time of the creation of the policy.

    description str

    The description of the iam policy.

    editable bool

    Whether the policy is editable.

    group_id str

    ID of the Group the policy will be linked to

    name str

    .The name of the iam policy.

    no_principal bool

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organization_id str

    ID of organization scoped to the rule.

    rules Sequence[IamPolicyRuleArgs]

    List of rules in the policy.

    updated_at str

    The date and time of the last update of the policy.

    user_id str

    ID of the User the policy will be linked to

    applicationId String

    ID of the Application the policy will be linked to

    createdAt String

    The date and time of the creation of the policy.

    description String

    The description of the iam policy.

    editable Boolean

    Whether the policy is editable.

    groupId String

    ID of the Group the policy will be linked to

    name String

    .The name of the iam policy.

    noPrincipal Boolean

    If the policy doesn't apply to a principal.

    Important Only one of user_id, group_id, application_id and no_principal may be set.

    organizationId String

    ID of organization scoped to the rule.

    rules List<Property Map>

    List of rules in the policy.

    updatedAt String

    The date and time of the last update of the policy.

    userId String

    ID of the User the policy will be linked to

    Supporting Types

    IamPolicyRule, IamPolicyRuleArgs

    PermissionSetNames List<string>

    Names of permission sets bound to the rule.

    TIP: You can use the Scaleway CLI to list the permissions details. e.g:

    OrganizationId string

    ID of organization scoped to the rule.

    ProjectIds List<string>

    List of project IDs scoped to the rule.

    Important One of organization_id or project_ids must be set per rule.

    PermissionSetNames []string

    Names of permission sets bound to the rule.

    TIP: You can use the Scaleway CLI to list the permissions details. e.g:

    OrganizationId string

    ID of organization scoped to the rule.

    ProjectIds []string

    List of project IDs scoped to the rule.

    Important One of organization_id or project_ids must be set per rule.

    permissionSetNames List<String>

    Names of permission sets bound to the rule.

    TIP: You can use the Scaleway CLI to list the permissions details. e.g:

    organizationId String

    ID of organization scoped to the rule.

    projectIds List<String>

    List of project IDs scoped to the rule.

    Important One of organization_id or project_ids must be set per rule.

    permissionSetNames string[]

    Names of permission sets bound to the rule.

    TIP: You can use the Scaleway CLI to list the permissions details. e.g:

    organizationId string

    ID of organization scoped to the rule.

    projectIds string[]

    List of project IDs scoped to the rule.

    Important One of organization_id or project_ids must be set per rule.

    permission_set_names Sequence[str]

    Names of permission sets bound to the rule.

    TIP: You can use the Scaleway CLI to list the permissions details. e.g:

    organization_id str

    ID of organization scoped to the rule.

    project_ids Sequence[str]

    List of project IDs scoped to the rule.

    Important One of organization_id or project_ids must be set per rule.

    permissionSetNames List<String>

    Names of permission sets bound to the rule.

    TIP: You can use the Scaleway CLI to list the permissions details. e.g:

    organizationId String

    ID of organization scoped to the rule.

    projectIds List<String>

    List of project IDs scoped to the rule.

    Important One of organization_id or project_ids must be set per rule.

    Import

    Policies can be imported using the {id}, e.g. bash

     $ pulumi import scaleway:index/iamPolicy:IamPolicy main 11111111-1111-1111-1111-111111111111
    

    Package Details

    Repository
    scaleway lbrlabs/pulumi-scaleway
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the scaleway Terraform Provider.

    scaleway logo
    Scaleway v1.10.0 published on Saturday, Jul 1, 2023 by lbrlabs