1. Packages
  2. Incapsula Provider
  3. API Docs
  4. AccountUser
incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva

incapsula.AccountUser

Explore with Pulumi AI

incapsula logo
incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva

    Provides an account user resource. This resource enables you to create users in an account and assign roles to them.

    The user roles should be added as ids which can be taken from incapsula.AccountRole resources as reference. In addition, the default account roles may be taken from the incapsula.getAccountRoles data source.

    This resource also provides the option to assign users to subaccounts. The usage is the same but the behavior differs slightly. See the ‘SubAccount User Assignment Usage’ example below for more details.

    Example Usage

    Basic Usage

    Sample user creation with no roles.

    import * as pulumi from "@pulumi/pulumi";
    import * as incapsula from "@pulumi/incapsula";
    
    const user1 = new incapsula.AccountUser("user1", {
        accountId: data.incapsula_account_data.account_data.current_account,
        email: "example@terraform.com",
        firstName: "First",
        lastName: "Last",
    });
    
    import pulumi
    import pulumi_incapsula as incapsula
    
    user1 = incapsula.AccountUser("user1",
        account_id=data["incapsula_account_data"]["account_data"]["current_account"],
        email="example@terraform.com",
        first_name="First",
        last_name="Last")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := incapsula.NewAccountUser(ctx, "user1", &incapsula.AccountUserArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    			Email:     pulumi.String("example@terraform.com"),
    			FirstName: pulumi.String("First"),
    			LastName:  pulumi.String("Last"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    return await Deployment.RunAsync(() => 
    {
        var user1 = new Incapsula.AccountUser("user1", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
            Email = "example@terraform.com",
            FirstName = "First",
            LastName = "Last",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.AccountUser;
    import com.pulumi.incapsula.AccountUserArgs;
    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 user1 = new AccountUser("user1", AccountUserArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .email("example@terraform.com")
                .firstName("First")
                .lastName("Last")
                .build());
    
        }
    }
    
    resources:
      user1:
        type: incapsula:AccountUser
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
          email: example@terraform.com
          firstName: First
          lastName: Last
    

    Role References Usage

    Usage with role reference.

    import * as pulumi from "@pulumi/pulumi";
    import * as incapsula from "@pulumi/incapsula";
    
    const role1 = new incapsula.AccountRole("role1", {accountId: data.incapsula_account_data.account_data.current_account});
    const role2 = new incapsula.AccountRole("role2", {accountId: data.incapsula_account_data.account_data.current_account});
    const user2 = new incapsula.AccountUser("user2", {
        accountId: data.incapsula_account_data.account_data.current_account,
        email: "example@terraform.com",
        firstName: "First",
        lastName: "Last",
        roleIds: [
            role1.accountRoleId,
            role2.accountRoleId,
        ],
    });
    
    import pulumi
    import pulumi_incapsula as incapsula
    
    role1 = incapsula.AccountRole("role1", account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    role2 = incapsula.AccountRole("role2", account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    user2 = incapsula.AccountUser("user2",
        account_id=data["incapsula_account_data"]["account_data"]["current_account"],
        email="example@terraform.com",
        first_name="First",
        last_name="Last",
        role_ids=[
            role1.account_role_id,
            role2.account_role_id,
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		role1, err := incapsula.NewAccountRole(ctx, "role1", &incapsula.AccountRoleArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    		})
    		if err != nil {
    			return err
    		}
    		role2, err := incapsula.NewAccountRole(ctx, "role2", &incapsula.AccountRoleArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = incapsula.NewAccountUser(ctx, "user2", &incapsula.AccountUserArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    			Email:     pulumi.String("example@terraform.com"),
    			FirstName: pulumi.String("First"),
    			LastName:  pulumi.String("Last"),
    			RoleIds: pulumi.Float64Array{
    				role1.AccountRoleId,
    				role2.AccountRoleId,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    return await Deployment.RunAsync(() => 
    {
        var role1 = new Incapsula.AccountRole("role1", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var role2 = new Incapsula.AccountRole("role2", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var user2 = new Incapsula.AccountUser("user2", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
            Email = "example@terraform.com",
            FirstName = "First",
            LastName = "Last",
            RoleIds = new[]
            {
                role1.AccountRoleId,
                role2.AccountRoleId,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.AccountRole;
    import com.pulumi.incapsula.AccountRoleArgs;
    import com.pulumi.incapsula.AccountUser;
    import com.pulumi.incapsula.AccountUserArgs;
    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 role1 = new AccountRole("role1", AccountRoleArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var role2 = new AccountRole("role2", AccountRoleArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var user2 = new AccountUser("user2", AccountUserArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .email("example@terraform.com")
                .firstName("First")
                .lastName("Last")
                .roleIds(            
                    role1.accountRoleId(),
                    role2.accountRoleId())
                .build());
    
        }
    }
    
    resources:
      role1:
        type: incapsula:AccountRole
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
      role2:
        type: incapsula:AccountRole
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
      user2:
        type: incapsula:AccountUser
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
          email: example@terraform.com
          firstName: First
          lastName: Last
          roleIds:
            - ${role1.accountRoleId}
            - ${role2.accountRoleId}
    

    Role References & Data Sources Usage

    Using incapsula.getAccountRoles data sources we can use admin_role_id/reader_role_id exported attributes.

    import * as pulumi from "@pulumi/pulumi";
    import * as incapsula from "@pulumi/incapsula";
    
    const roles = incapsula.getAccountRoles({
        accountId: data.incapsula_account_data.account_data.current_account,
    });
    const role1 = new incapsula.AccountRole("role1", {accountId: data.incapsula_account_data.account_data.current_account});
    const role2 = new incapsula.AccountRole("role2", {accountId: data.incapsula_account_data.account_data.current_account});
    const user3 = new incapsula.AccountUser("user3", {
        accountId: data.incapsula_account_data.account_data.current_account,
        email: "example@terraform.com",
        firstName: "First",
        lastName: "Last",
        roleIds: [
            role1.accountRoleId,
            role2.accountRoleId,
            roles.then(roles => roles.readerRoleId),
        ],
    });
    
    import pulumi
    import pulumi_incapsula as incapsula
    
    roles = incapsula.get_account_roles(account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    role1 = incapsula.AccountRole("role1", account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    role2 = incapsula.AccountRole("role2", account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    user3 = incapsula.AccountUser("user3",
        account_id=data["incapsula_account_data"]["account_data"]["current_account"],
        email="example@terraform.com",
        first_name="First",
        last_name="Last",
        role_ids=[
            role1.account_role_id,
            role2.account_role_id,
            roles.reader_role_id,
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		roles, err := incapsula.GetAccountRoles(ctx, &incapsula.GetAccountRolesArgs{
    			AccountId: data.Incapsula_account_data.Account_data.Current_account,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		role1, err := incapsula.NewAccountRole(ctx, "role1", &incapsula.AccountRoleArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    		})
    		if err != nil {
    			return err
    		}
    		role2, err := incapsula.NewAccountRole(ctx, "role2", &incapsula.AccountRoleArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = incapsula.NewAccountUser(ctx, "user3", &incapsula.AccountUserArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    			Email:     pulumi.String("example@terraform.com"),
    			FirstName: pulumi.String("First"),
    			LastName:  pulumi.String("Last"),
    			RoleIds: pulumi.Float64Array{
    				role1.AccountRoleId,
    				role2.AccountRoleId,
    				pulumi.Float64(roles.ReaderRoleId),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    return await Deployment.RunAsync(() => 
    {
        var roles = Incapsula.GetAccountRoles.Invoke(new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var role1 = new Incapsula.AccountRole("role1", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var role2 = new Incapsula.AccountRole("role2", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var user3 = new Incapsula.AccountUser("user3", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
            Email = "example@terraform.com",
            FirstName = "First",
            LastName = "Last",
            RoleIds = new[]
            {
                role1.AccountRoleId,
                role2.AccountRoleId,
                roles.Apply(getAccountRolesResult => getAccountRolesResult.ReaderRoleId),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.IncapsulaFunctions;
    import com.pulumi.incapsula.inputs.GetAccountRolesArgs;
    import com.pulumi.incapsula.AccountRole;
    import com.pulumi.incapsula.AccountRoleArgs;
    import com.pulumi.incapsula.AccountUser;
    import com.pulumi.incapsula.AccountUserArgs;
    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 roles = IncapsulaFunctions.getAccountRoles(GetAccountRolesArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var role1 = new AccountRole("role1", AccountRoleArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var role2 = new AccountRole("role2", AccountRoleArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var user3 = new AccountUser("user3", AccountUserArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .email("example@terraform.com")
                .firstName("First")
                .lastName("Last")
                .roleIds(            
                    role1.accountRoleId(),
                    role2.accountRoleId(),
                    roles.applyValue(getAccountRolesResult -> getAccountRolesResult.readerRoleId()))
                .build());
    
        }
    }
    
    resources:
      role1:
        type: incapsula:AccountRole
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
      role2:
        type: incapsula:AccountRole
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
      user3:
        type: incapsula:AccountUser
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
          email: example@terraform.com
          firstName: First
          lastName: Last
          roleIds:
            - ${role1.accountRoleId}
            - ${role2.accountRoleId}
            - ${roles.readerRoleId}
    variables:
      roles:
        fn::invoke:
          function: incapsula:getAccountRoles
          arguments:
            accountId: ${data.incapsula_account_data.account_data.current_account}
    

    SubAccount User Assignment Usage - Manage by Account

    For subaccounts we are not creating a new user but assigning an existing user from the parent account. In terms of the TF resource, it means the email attribute must be taken from an existing user, by reference (preferred option) or hardcoded. The first and last name are redundant and will be taken from the existing selected account. The roles are not taken from the existing user and must be assigned independently.

    import * as pulumi from "@pulumi/pulumi";
    import * as incapsula from "@pulumi/incapsula";
    
    const role1 = new incapsula.AccountRole("role1", {accountId: data.incapsula_account_data.account_data.current_account});
    const user1 = new incapsula.AccountUser("user1", {
        accountId: data.incapsula_account_data.account_data.current_account,
        email: "example@terraform.com",
        firstName: "First",
        lastName: "Last",
    });
    const user2 = new incapsula.AccountUser("user2", {
        accountId: incapsula_subaccount["example-subaccount"].id,
        email: user1.email,
        roleIds: [role1.accountRoleId],
    });
    
    import pulumi
    import pulumi_incapsula as incapsula
    
    role1 = incapsula.AccountRole("role1", account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    user1 = incapsula.AccountUser("user1",
        account_id=data["incapsula_account_data"]["account_data"]["current_account"],
        email="example@terraform.com",
        first_name="First",
        last_name="Last")
    user2 = incapsula.AccountUser("user2",
        account_id=incapsula_subaccount["example-subaccount"]["id"],
        email=user1.email,
        role_ids=[role1.account_role_id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		role1, err := incapsula.NewAccountRole(ctx, "role1", &incapsula.AccountRoleArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    		})
    		if err != nil {
    			return err
    		}
    		user1, err := incapsula.NewAccountUser(ctx, "user1", &incapsula.AccountUserArgs{
    			AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    			Email:     pulumi.String("example@terraform.com"),
    			FirstName: pulumi.String("First"),
    			LastName:  pulumi.String("Last"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = incapsula.NewAccountUser(ctx, "user2", &incapsula.AccountUserArgs{
    			AccountId: pulumi.Any(incapsula_subaccount.ExampleSubaccount.Id),
    			Email:     user1.Email,
    			RoleIds: pulumi.Float64Array{
    				role1.AccountRoleId,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    return await Deployment.RunAsync(() => 
    {
        var role1 = new Incapsula.AccountRole("role1", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var user1 = new Incapsula.AccountUser("user1", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
            Email = "example@terraform.com",
            FirstName = "First",
            LastName = "Last",
        });
    
        var user2 = new Incapsula.AccountUser("user2", new()
        {
            AccountId = incapsula_subaccount.Example_subaccount.Id,
            Email = user1.Email,
            RoleIds = new[]
            {
                role1.AccountRoleId,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.AccountRole;
    import com.pulumi.incapsula.AccountRoleArgs;
    import com.pulumi.incapsula.AccountUser;
    import com.pulumi.incapsula.AccountUserArgs;
    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 role1 = new AccountRole("role1", AccountRoleArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var user1 = new AccountUser("user1", AccountUserArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .email("example@terraform.com")
                .firstName("First")
                .lastName("Last")
                .build());
    
            var user2 = new AccountUser("user2", AccountUserArgs.builder()
                .accountId(incapsula_subaccount.example-subaccount().id())
                .email(user1.email())
                .roleIds(role1.accountRoleId())
                .build());
    
        }
    }
    
    resources:
      role1:
        type: incapsula:AccountRole
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
      user1:
        type: incapsula:AccountUser
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
          email: example@terraform.com
          firstName: First
          lastName: Last
      user2:
        type: incapsula:AccountUser
        properties:
          accountId: ${incapsula_subaccount"example-subaccount"[%!s(MISSING)].id}
          email: ${user1.email}
          roleIds:
            - ${role1.accountRoleId}
    

    SubAccount User Assignment Usage - Manage by SubAccount

    If the API_KEY and API_ID are associated with a subaccount, we don’t have the option to manage roles and need to use the incapsula.getAccountRoles data source. Using the map attribute, this data source generates a mapping for all the account roles (Role Name to Id map).

    import * as pulumi from "@pulumi/pulumi";
    import * as incapsula from "@pulumi/incapsula";
    
    const roles = incapsula.getAccountRoles({
        accountId: data.incapsula_account_data.account_data.current_account,
    });
    const user2 = new incapsula.AccountUser("user2", {
        accountId: data.incapsula_account_data.account_data.current_account,
        email: "example@terraform.com",
        roleIds: [roles.then(roles => roles.map?.["Sample Role 1"])],
    });
    
    import pulumi
    import pulumi_incapsula as incapsula
    
    roles = incapsula.get_account_roles(account_id=data["incapsula_account_data"]["account_data"]["current_account"])
    user2 = incapsula.AccountUser("user2",
        account_id=data["incapsula_account_data"]["account_data"]["current_account"],
        email="example@terraform.com",
        role_ids=[roles.map["Sample Role 1"]])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    roles, err := incapsula.GetAccountRoles(ctx, &incapsula.GetAccountRolesArgs{
    AccountId: data.Incapsula_account_data.Account_data.Current_account,
    }, nil);
    if err != nil {
    return err
    }
    _, err = incapsula.NewAccountUser(ctx, "user2", &incapsula.AccountUserArgs{
    AccountId: pulumi.Any(data.Incapsula_account_data.Account_data.Current_account),
    Email: pulumi.String("example@terraform.com"),
    RoleIds: pulumi.Float64Array{
    pulumi.Float64(roles.Map.Sample Role 1),
    },
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    return await Deployment.RunAsync(() => 
    {
        var roles = Incapsula.GetAccountRoles.Invoke(new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
        });
    
        var user2 = new Incapsula.AccountUser("user2", new()
        {
            AccountId = data.Incapsula_account_data.Account_data.Current_account,
            Email = "example@terraform.com",
            RoleIds = new[]
            {
                roles.Apply(getAccountRolesResult => getAccountRolesResult.Map?.Sample_Role_1),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.IncapsulaFunctions;
    import com.pulumi.incapsula.inputs.GetAccountRolesArgs;
    import com.pulumi.incapsula.AccountUser;
    import com.pulumi.incapsula.AccountUserArgs;
    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 roles = IncapsulaFunctions.getAccountRoles(GetAccountRolesArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .build());
    
            var user2 = new AccountUser("user2", AccountUserArgs.builder()
                .accountId(data.incapsula_account_data().account_data().current_account())
                .email("example@terraform.com")
                .roleIds(roles.applyValue(getAccountRolesResult -> getAccountRolesResult.map().Sample Role 1()))
                .build());
    
        }
    }
    
    resources:
      user2:
        type: incapsula:AccountUser
        properties:
          accountId: ${data.incapsula_account_data.account_data.current_account}
          email: example@terraform.com
          roleIds:
            - ${roles.map"Sample Role 1"[%!s(MISSING)]}
    variables:
      roles:
        fn::invoke:
          function: incapsula:getAccountRoles
          arguments:
            accountId: ${data.incapsula_account_data.account_data.current_account}
    

    Create AccountUser Resource

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

    Constructor syntax

    new AccountUser(name: string, args: AccountUserArgs, opts?: CustomResourceOptions);
    @overload
    def AccountUser(resource_name: str,
                    args: AccountUserArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def AccountUser(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    account_id: Optional[float] = None,
                    email: Optional[str] = None,
                    account_user_id: Optional[str] = None,
                    first_name: Optional[str] = None,
                    last_name: Optional[str] = None,
                    role_ids: Optional[Sequence[float]] = None)
    func NewAccountUser(ctx *Context, name string, args AccountUserArgs, opts ...ResourceOption) (*AccountUser, error)
    public AccountUser(string name, AccountUserArgs args, CustomResourceOptions? opts = null)
    public AccountUser(String name, AccountUserArgs args)
    public AccountUser(String name, AccountUserArgs args, CustomResourceOptions options)
    
    type: incapsula:AccountUser
    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 AccountUserArgs
    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 AccountUserArgs
    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 AccountUserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccountUserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccountUserArgs
    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 accountUserResource = new Incapsula.AccountUser("accountUserResource", new()
    {
        AccountId = 0,
        Email = "string",
        AccountUserId = "string",
        FirstName = "string",
        LastName = "string",
        RoleIds = new[]
        {
            0,
        },
    });
    
    example, err := incapsula.NewAccountUser(ctx, "accountUserResource", &incapsula.AccountUserArgs{
    	AccountId:     pulumi.Float64(0),
    	Email:         pulumi.String("string"),
    	AccountUserId: pulumi.String("string"),
    	FirstName:     pulumi.String("string"),
    	LastName:      pulumi.String("string"),
    	RoleIds: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    })
    
    var accountUserResource = new AccountUser("accountUserResource", AccountUserArgs.builder()
        .accountId(0)
        .email("string")
        .accountUserId("string")
        .firstName("string")
        .lastName("string")
        .roleIds(0)
        .build());
    
    account_user_resource = incapsula.AccountUser("accountUserResource",
        account_id=0,
        email="string",
        account_user_id="string",
        first_name="string",
        last_name="string",
        role_ids=[0])
    
    const accountUserResource = new incapsula.AccountUser("accountUserResource", {
        accountId: 0,
        email: "string",
        accountUserId: "string",
        firstName: "string",
        lastName: "string",
        roleIds: [0],
    });
    
    type: incapsula:AccountUser
    properties:
        accountId: 0
        accountUserId: string
        email: string
        firstName: string
        lastName: string
        roleIds:
            - 0
    

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

    AccountId double
    Numeric identifier of the account to operate on. Using reference to account datasource
    Email string
    The user email. This attribute cannot be updated.
    AccountUserId string
    Unique identifier in the API for the account user.
    FirstName string
    The user's first name. This attribute cannot be updated.
    LastName string
    The user's last name. This attribute cannot be updated.
    RoleIds List<double>
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    AccountId float64
    Numeric identifier of the account to operate on. Using reference to account datasource
    Email string
    The user email. This attribute cannot be updated.
    AccountUserId string
    Unique identifier in the API for the account user.
    FirstName string
    The user's first name. This attribute cannot be updated.
    LastName string
    The user's last name. This attribute cannot be updated.
    RoleIds []float64
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    accountId Double
    Numeric identifier of the account to operate on. Using reference to account datasource
    email String
    The user email. This attribute cannot be updated.
    accountUserId String
    Unique identifier in the API for the account user.
    firstName String
    The user's first name. This attribute cannot be updated.
    lastName String
    The user's last name. This attribute cannot be updated.
    roleIds List<Double>
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    accountId number
    Numeric identifier of the account to operate on. Using reference to account datasource
    email string
    The user email. This attribute cannot be updated.
    accountUserId string
    Unique identifier in the API for the account user.
    firstName string
    The user's first name. This attribute cannot be updated.
    lastName string
    The user's last name. This attribute cannot be updated.
    roleIds number[]
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    account_id float
    Numeric identifier of the account to operate on. Using reference to account datasource
    email str
    The user email. This attribute cannot be updated.
    account_user_id str
    Unique identifier in the API for the account user.
    first_name str
    The user's first name. This attribute cannot be updated.
    last_name str
    The user's last name. This attribute cannot be updated.
    role_ids Sequence[float]
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    accountId Number
    Numeric identifier of the account to operate on. Using reference to account datasource
    email String
    The user email. This attribute cannot be updated.
    accountUserId String
    Unique identifier in the API for the account user.
    firstName String
    The user's first name. This attribute cannot be updated.
    lastName String
    The user's last name. This attribute cannot be updated.
    roleIds List<Number>
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    RoleNames List<string>
    List of role names.
    Id string
    The provider-assigned unique ID for this managed resource.
    RoleNames []string
    List of role names.
    id String
    The provider-assigned unique ID for this managed resource.
    roleNames List<String>
    List of role names.
    id string
    The provider-assigned unique ID for this managed resource.
    roleNames string[]
    List of role names.
    id str
    The provider-assigned unique ID for this managed resource.
    role_names Sequence[str]
    List of role names.
    id String
    The provider-assigned unique ID for this managed resource.
    roleNames List<String>
    List of role names.

    Look up Existing AccountUser Resource

    Get an existing AccountUser 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?: AccountUserState, opts?: CustomResourceOptions): AccountUser
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[float] = None,
            account_user_id: Optional[str] = None,
            email: Optional[str] = None,
            first_name: Optional[str] = None,
            last_name: Optional[str] = None,
            role_ids: Optional[Sequence[float]] = None,
            role_names: Optional[Sequence[str]] = None) -> AccountUser
    func GetAccountUser(ctx *Context, name string, id IDInput, state *AccountUserState, opts ...ResourceOption) (*AccountUser, error)
    public static AccountUser Get(string name, Input<string> id, AccountUserState? state, CustomResourceOptions? opts = null)
    public static AccountUser get(String name, Output<String> id, AccountUserState state, CustomResourceOptions options)
    resources:  _:    type: incapsula:AccountUser    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 double
    Numeric identifier of the account to operate on. Using reference to account datasource
    AccountUserId string
    Unique identifier in the API for the account user.
    Email string
    The user email. This attribute cannot be updated.
    FirstName string
    The user's first name. This attribute cannot be updated.
    LastName string
    The user's last name. This attribute cannot be updated.
    RoleIds List<double>
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    RoleNames List<string>
    List of role names.
    AccountId float64
    Numeric identifier of the account to operate on. Using reference to account datasource
    AccountUserId string
    Unique identifier in the API for the account user.
    Email string
    The user email. This attribute cannot be updated.
    FirstName string
    The user's first name. This attribute cannot be updated.
    LastName string
    The user's last name. This attribute cannot be updated.
    RoleIds []float64
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    RoleNames []string
    List of role names.
    accountId Double
    Numeric identifier of the account to operate on. Using reference to account datasource
    accountUserId String
    Unique identifier in the API for the account user.
    email String
    The user email. This attribute cannot be updated.
    firstName String
    The user's first name. This attribute cannot be updated.
    lastName String
    The user's last name. This attribute cannot be updated.
    roleIds List<Double>
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    roleNames List<String>
    List of role names.
    accountId number
    Numeric identifier of the account to operate on. Using reference to account datasource
    accountUserId string
    Unique identifier in the API for the account user.
    email string
    The user email. This attribute cannot be updated.
    firstName string
    The user's first name. This attribute cannot be updated.
    lastName string
    The user's last name. This attribute cannot be updated.
    roleIds number[]
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    roleNames string[]
    List of role names.
    account_id float
    Numeric identifier of the account to operate on. Using reference to account datasource
    account_user_id str
    Unique identifier in the API for the account user.
    email str
    The user email. This attribute cannot be updated.
    first_name str
    The user's first name. This attribute cannot be updated.
    last_name str
    The user's last name. This attribute cannot be updated.
    role_ids Sequence[float]
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    role_names Sequence[str]
    List of role names.
    accountId Number
    Numeric identifier of the account to operate on. Using reference to account datasource
    accountUserId String
    Unique identifier in the API for the account user.
    email String
    The user email. This attribute cannot be updated.
    firstName String
    The user's first name. This attribute cannot be updated.
    lastName String
    The user's last name. This attribute cannot be updated.
    roleIds List<Number>
    List of role ids to be associated with the user. Default value is an empty list (user with no roles).
    roleNames List<String>
    List of role names.

    Import

    Account User can be imported using the account_id and email separated by /, e.g.:

    $ pulumi import incapsula:index/accountUser:AccountUser demo 1234/example@terraform.com
    

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

    Package Details

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