1. Packages
  2. Commercetools Provider
  3. API Docs
  4. CustomerGroup
commercetools 1.19.2 published on Friday, Mar 7, 2025 by labd

commercetools.CustomerGroup

Explore with Pulumi AI

commercetools logo
commercetools 1.19.2 published on Friday, Mar 7, 2025 by labd

    A Customer can be a member of a customer group (for example reseller, gold member). Special prices can be assigned to specific products based on a customer group.

    See also the Customer Group API Documentation

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as commercetools from "@pulumi/commercetools";
    
    const standard = new commercetools.CustomerGroup("standard", {key: "my-customer-group-key"});
    const golden = new commercetools.CustomerGroup("golden", {key: "my-customer-group-key"});
    
    import pulumi
    import pulumi_commercetools as commercetools
    
    standard = commercetools.CustomerGroup("standard", key="my-customer-group-key")
    golden = commercetools.CustomerGroup("golden", key="my-customer-group-key")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/commercetools/commercetools"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := commercetools.NewCustomerGroup(ctx, "standard", &commercetools.CustomerGroupArgs{
    			Key: pulumi.String("my-customer-group-key"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = commercetools.NewCustomerGroup(ctx, "golden", &commercetools.CustomerGroupArgs{
    			Key: pulumi.String("my-customer-group-key"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Commercetools = Pulumi.Commercetools;
    
    return await Deployment.RunAsync(() => 
    {
        var standard = new Commercetools.CustomerGroup("standard", new()
        {
            Key = "my-customer-group-key",
        });
    
        var golden = new Commercetools.CustomerGroup("golden", new()
        {
            Key = "my-customer-group-key",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.commercetools.CustomerGroup;
    import com.pulumi.commercetools.CustomerGroupArgs;
    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 standard = new CustomerGroup("standard", CustomerGroupArgs.builder()
                .key("my-customer-group-key")
                .build());
    
            var golden = new CustomerGroup("golden", CustomerGroupArgs.builder()
                .key("my-customer-group-key")
                .build());
    
        }
    }
    
    resources:
      standard:
        type: commercetools:CustomerGroup
        properties:
          key: my-customer-group-key
      golden:
        type: commercetools:CustomerGroup
        properties:
          key: my-customer-group-key
    

    Create CustomerGroup Resource

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

    Constructor syntax

    new CustomerGroup(name: string, args?: CustomerGroupArgs, opts?: CustomResourceOptions);
    @overload
    def CustomerGroup(resource_name: str,
                      args: Optional[CustomerGroupArgs] = None,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomerGroup(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      custom: Optional[CustomerGroupCustomArgs] = None,
                      customer_group_id: Optional[str] = None,
                      key: Optional[str] = None,
                      name: Optional[str] = None)
    func NewCustomerGroup(ctx *Context, name string, args *CustomerGroupArgs, opts ...ResourceOption) (*CustomerGroup, error)
    public CustomerGroup(string name, CustomerGroupArgs? args = null, CustomResourceOptions? opts = null)
    public CustomerGroup(String name, CustomerGroupArgs args)
    public CustomerGroup(String name, CustomerGroupArgs args, CustomResourceOptions options)
    
    type: commercetools:CustomerGroup
    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 CustomerGroupArgs
    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 CustomerGroupArgs
    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 CustomerGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomerGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomerGroupArgs
    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 customerGroupResource = new Commercetools.CustomerGroup("customerGroupResource", new()
    {
        Custom = new Commercetools.Inputs.CustomerGroupCustomArgs
        {
            TypeId = "string",
            Fields = 
            {
                { "string", "string" },
            },
        },
        CustomerGroupId = "string",
        Key = "string",
        Name = "string",
    });
    
    example, err := commercetools.NewCustomerGroup(ctx, "customerGroupResource", &commercetools.CustomerGroupArgs{
    Custom: &.CustomerGroupCustomArgs{
    TypeId: pulumi.String("string"),
    Fields: pulumi.StringMap{
    "string": pulumi.String("string"),
    },
    },
    CustomerGroupId: pulumi.String("string"),
    Key: pulumi.String("string"),
    Name: pulumi.String("string"),
    })
    
    var customerGroupResource = new CustomerGroup("customerGroupResource", CustomerGroupArgs.builder()
        .custom(CustomerGroupCustomArgs.builder()
            .typeId("string")
            .fields(Map.of("string", "string"))
            .build())
        .customerGroupId("string")
        .key("string")
        .name("string")
        .build());
    
    customer_group_resource = commercetools.CustomerGroup("customerGroupResource",
        custom={
            "type_id": "string",
            "fields": {
                "string": "string",
            },
        },
        customer_group_id="string",
        key="string",
        name="string")
    
    const customerGroupResource = new commercetools.CustomerGroup("customerGroupResource", {
        custom: {
            typeId: "string",
            fields: {
                string: "string",
            },
        },
        customerGroupId: "string",
        key: "string",
        name: "string",
    });
    
    type: commercetools:CustomerGroup
    properties:
        custom:
            fields:
                string: string
            typeId: string
        customerGroupId: string
        key: string
        name: string
    

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

    Custom CustomerGroupCustom
    CustomerGroupId string
    The ID of this resource.
    Key string
    User-specific unique identifier for the customer group
    Name string
    Unique within the project
    Custom CustomerGroupCustomArgs
    CustomerGroupId string
    The ID of this resource.
    Key string
    User-specific unique identifier for the customer group
    Name string
    Unique within the project
    custom CustomerGroupCustom
    customerGroupId String
    The ID of this resource.
    key String
    User-specific unique identifier for the customer group
    name String
    Unique within the project
    custom CustomerGroupCustom
    customerGroupId string
    The ID of this resource.
    key string
    User-specific unique identifier for the customer group
    name string
    Unique within the project
    custom CustomerGroupCustomArgs
    customer_group_id str
    The ID of this resource.
    key str
    User-specific unique identifier for the customer group
    name str
    Unique within the project
    custom Property Map
    customerGroupId String
    The ID of this resource.
    key String
    User-specific unique identifier for the customer group
    name String
    Unique within the project

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Version double
    Id string
    The provider-assigned unique ID for this managed resource.
    Version float64
    id String
    The provider-assigned unique ID for this managed resource.
    version Double
    id string
    The provider-assigned unique ID for this managed resource.
    version number
    id str
    The provider-assigned unique ID for this managed resource.
    version float
    id String
    The provider-assigned unique ID for this managed resource.
    version Number

    Look up Existing CustomerGroup Resource

    Get an existing CustomerGroup 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?: CustomerGroupState, opts?: CustomResourceOptions): CustomerGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            custom: Optional[CustomerGroupCustomArgs] = None,
            customer_group_id: Optional[str] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            version: Optional[float] = None) -> CustomerGroup
    func GetCustomerGroup(ctx *Context, name string, id IDInput, state *CustomerGroupState, opts ...ResourceOption) (*CustomerGroup, error)
    public static CustomerGroup Get(string name, Input<string> id, CustomerGroupState? state, CustomResourceOptions? opts = null)
    public static CustomerGroup get(String name, Output<String> id, CustomerGroupState state, CustomResourceOptions options)
    resources:  _:    type: commercetools:CustomerGroup    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:
    Custom CustomerGroupCustom
    CustomerGroupId string
    The ID of this resource.
    Key string
    User-specific unique identifier for the customer group
    Name string
    Unique within the project
    Version double
    Custom CustomerGroupCustomArgs
    CustomerGroupId string
    The ID of this resource.
    Key string
    User-specific unique identifier for the customer group
    Name string
    Unique within the project
    Version float64
    custom CustomerGroupCustom
    customerGroupId String
    The ID of this resource.
    key String
    User-specific unique identifier for the customer group
    name String
    Unique within the project
    version Double
    custom CustomerGroupCustom
    customerGroupId string
    The ID of this resource.
    key string
    User-specific unique identifier for the customer group
    name string
    Unique within the project
    version number
    custom CustomerGroupCustomArgs
    customer_group_id str
    The ID of this resource.
    key str
    User-specific unique identifier for the customer group
    name str
    Unique within the project
    version float
    custom Property Map
    customerGroupId String
    The ID of this resource.
    key String
    User-specific unique identifier for the customer group
    name String
    Unique within the project
    version Number

    Supporting Types

    CustomerGroupCustom, CustomerGroupCustomArgs

    TypeId string
    Fields Dictionary<string, string>
    Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
    TypeId string
    Fields map[string]string
    Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
    typeId String
    fields Map<String,String>
    Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
    typeId string
    fields {[key: string]: string}
    Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
    type_id str
    fields Mapping[str, str]
    Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
    typeId String
    fields Map<String>
    Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})

    Package Details

    Repository
    commercetools labd/terraform-provider-commercetools
    License
    Notes
    This Pulumi package is based on the commercetools Terraform Provider.
    commercetools logo
    commercetools 1.19.2 published on Friday, Mar 7, 2025 by labd