scaleway.IamPolicy
Explore with Pulumi AI
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.
Pulumi Package. Scaleway. Inputs. Iam Policy Rule> List of rules in the policy.
- Application
Id string ID of the Application the policy will be linked to
- Description string
The description of the iam policy.
- Group
Id string ID of the Group the policy will be linked to
- Name string
.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
andno_principal
may be set.- Organization
Id string ID of organization scoped to the rule.
- User
Id string ID of the User the policy will be linked to
- Rules
[]Iam
Policy Rule Args List of rules in the policy.
- Application
Id string ID of the Application the policy will be linked to
- Description string
The description of the iam policy.
- Group
Id string ID of the Group the policy will be linked to
- Name string
.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
andno_principal
may be set.- Organization
Id string ID of organization scoped to the rule.
- User
Id string ID of the User the policy will be linked to
- rules
List<Iam
Policy Rule> List of rules in the policy.
- application
Id String ID of the Application the policy will be linked to
- description String
The description of the iam policy.
- group
Id String ID of the Group the policy will be linked to
- name String
.The name of the iam policy.
- no
Principal Boolean If the policy doesn't apply to a principal.
Important Only one of
user_id
,group_id
,application_id
andno_principal
may be set.- organization
Id String ID of organization scoped to the rule.
- user
Id String ID of the User the policy will be linked to
- rules
Iam
Policy Rule[] List of rules in the policy.
- application
Id string ID of the Application the policy will be linked to
- description string
The description of the iam policy.
- group
Id string ID of the Group the policy will be linked to
- name string
.The name of the iam policy.
- no
Principal boolean If the policy doesn't apply to a principal.
Important Only one of
user_id
,group_id
,application_id
andno_principal
may be set.- organization
Id string ID of organization scoped to the rule.
- user
Id string ID of the User the policy will be linked to
- rules
Sequence[Iam
Policy Rule Args] 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
andno_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.
- application
Id String ID of the Application the policy will be linked to
- description String
The description of the iam policy.
- group
Id String ID of the Group the policy will be linked to
- name String
.The name of the iam policy.
- no
Principal Boolean If the policy doesn't apply to a principal.
Important Only one of
user_id
,group_id
,application_id
andno_principal
may be set.- organization
Id String ID of organization scoped to the rule.
- user
Id 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:
- 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.
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.
- Application
Id string ID of the Application the policy will be linked to
- Created
At 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.
- Group
Id string ID of the Group the policy will be linked to
- Name string
.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
andno_principal
may be set.- Organization
Id string ID of organization scoped to the rule.
- Rules
List<Lbrlabs.
Pulumi Package. Scaleway. Inputs. Iam Policy Rule> List of rules in the policy.
- Updated
At string The date and time of the last update of the policy.
- User
Id string ID of the User the policy will be linked to
- Application
Id string ID of the Application the policy will be linked to
- Created
At 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.
- Group
Id string ID of the Group the policy will be linked to
- Name string
.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
andno_principal
may be set.- Organization
Id string ID of organization scoped to the rule.
- Rules
[]Iam
Policy Rule Args List of rules in the policy.
- Updated
At string The date and time of the last update of the policy.
- User
Id string ID of the User the policy will be linked to
- application
Id String ID of the Application the policy will be linked to
- created
At 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.
- group
Id String ID of the Group the policy will be linked to
- name String
.The name of the iam policy.
- no
Principal Boolean If the policy doesn't apply to a principal.
Important Only one of
user_id
,group_id
,application_id
andno_principal
may be set.- organization
Id String ID of organization scoped to the rule.
- rules
List<Iam
Policy Rule> List of rules in the policy.
- updated
At String The date and time of the last update of the policy.
- user
Id String ID of the User the policy will be linked to
- application
Id string ID of the Application the policy will be linked to
- created
At 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.
- group
Id string ID of the Group the policy will be linked to
- name string
.The name of the iam policy.
- no
Principal boolean If the policy doesn't apply to a principal.
Important Only one of
user_id
,group_id
,application_id
andno_principal
may be set.- organization
Id string ID of organization scoped to the rule.
- rules
Iam
Policy Rule[] List of rules in the policy.
- updated
At string The date and time of the last update of the policy.
- user
Id 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
andno_principal
may be set.- organization_
id str ID of organization scoped to the rule.
- rules
Sequence[Iam
Policy Rule Args] 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
- application
Id String ID of the Application the policy will be linked to
- created
At 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.
- group
Id String ID of the Group the policy will be linked to
- name String
.The name of the iam policy.
- no
Principal Boolean If the policy doesn't apply to a principal.
Important Only one of
user_id
,group_id
,application_id
andno_principal
may be set.- organization
Id String ID of organization scoped to the rule.
- rules List<Property Map>
List of rules in the policy.
- updated
At String The date and time of the last update of the policy.
- user
Id String ID of the User the policy will be linked to
Supporting Types
IamPolicyRule, IamPolicyRuleArgs
- Permission
Set List<string>Names Names of permission sets bound to the rule.
TIP: You can use the Scaleway CLI to list the permissions details. e.g:
- Organization
Id string ID of organization scoped to the rule.
- Project
Ids List<string> List of project IDs scoped to the rule.
Important One of
organization_id
orproject_ids
must be set per rule.
- Permission
Set []stringNames Names of permission sets bound to the rule.
TIP: You can use the Scaleway CLI to list the permissions details. e.g:
- Organization
Id string ID of organization scoped to the rule.
- Project
Ids []string List of project IDs scoped to the rule.
Important One of
organization_id
orproject_ids
must be set per rule.
- permission
Set List<String>Names Names of permission sets bound to the rule.
TIP: You can use the Scaleway CLI to list the permissions details. e.g:
- organization
Id String ID of organization scoped to the rule.
- project
Ids List<String> List of project IDs scoped to the rule.
Important One of
organization_id
orproject_ids
must be set per rule.
- permission
Set string[]Names Names of permission sets bound to the rule.
TIP: You can use the Scaleway CLI to list the permissions details. e.g:
- organization
Id string ID of organization scoped to the rule.
- project
Ids string[] List of project IDs scoped to the rule.
Important One of
organization_id
orproject_ids
must be set per rule.
- permission_
set_ Sequence[str]names 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
orproject_ids
must be set per rule.
- permission
Set List<String>Names Names of permission sets bound to the rule.
TIP: You can use the Scaleway CLI to list the permissions details. e.g:
- organization
Id String ID of organization scoped to the rule.
- project
Ids List<String> List of project IDs scoped to the rule.
Important One of
organization_id
orproject_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.