1. Packages
  2. Commercetools Provider
  3. API Docs
  4. ProductType
commercetools 1.19.3 published on Friday, Apr 4, 2025 by labd

commercetools.ProductType

Explore with Pulumi AI

Product types are used to describe common characteristics, most importantly common custom attributes, of many concrete products. Please note: to customize other resources than products, please refer to resource_type.

See also the Product Type API Documentation

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as commercetools from "@pulumi/commercetools";

const some_generic_properties_product_type = new commercetools.ProductType("some-generic-properties-product-type", {
    key: "some-key",
    description: "All the generic product properties",
    attributes: [{
        name: "perishable",
        label: {
            en: "Is perishable",
            nl: "Is perishable",
        },
        required: true,
        type: {
            name: "boolean",
        },
    }],
});
const my_product_type = new commercetools.ProductType("my-product-type", {
    key: "my-product-type-key",
    description: "All the specific info concerning the lens",
    attributes: [
        {
            name: "autofocus",
            label: {
                en: "Has autofocus",
                nl: "Heeft autofocus",
            },
            required: true,
            type: {
                name: "boolean",
            },
        },
        {
            name: "lens_product_no",
            label: {
                en: "Lens product number",
                nl: "Objectief productnummer",
            },
            required: true,
            type: {
                name: "text",
            },
            constraint: "Unique",
            inputTip: {
                en: "Enter the product code",
                nl: "Voer de product code in",
            },
            searchable: true,
        },
        {
            name: "previous_model",
            label: {
                en: "Previous model",
                nl: "Vorig model",
            },
            type: {
                name: "reference",
                referenceTypeId: "product",
            },
        },
        {
            name: "product_properties",
            label: {
                en: "Product properties",
                nl: "Product eigenschappen",
            },
            required: false,
            type: {
                name: "nested",
                typeReference: some_generic_properties_product_type.productTypeId,
            },
        },
        {
            name: "some-flag",
            label: {
                en: "Some flag",
                nl: "Een vlag",
            },
            required: false,
            type: {
                name: "enum",
                values: [
                    {
                        key: "FLAG-1",
                        label: "Flag 1",
                    },
                    {
                        key: "FLAG-2",
                        label: "FLAG-2",
                    },
                ],
            },
        },
        {
            name: "origin",
            label: {
                en: "Origin country",
                nl: "Land van herkomst",
            },
            required: false,
            type: {
                name: "set",
                elementType: {
                    name: "lenum",
                    localizedValues: [
                        {
                            key: "NL",
                            label: {
                                en: "Netherlands",
                                nl: "Nederland",
                            },
                        },
                        {
                            key: "DE",
                            label: {
                                en: "Germany",
                                nl: "Duitsland",
                            },
                        },
                    ],
                },
            },
        },
    ],
});
Copy
import pulumi
import pulumi_commercetools as commercetools

some_generic_properties_product_type = commercetools.ProductType("some-generic-properties-product-type",
    key="some-key",
    description="All the generic product properties",
    attributes=[{
        "name": "perishable",
        "label": {
            "en": "Is perishable",
            "nl": "Is perishable",
        },
        "required": True,
        "type": {
            "name": "boolean",
        },
    }])
my_product_type = commercetools.ProductType("my-product-type",
    key="my-product-type-key",
    description="All the specific info concerning the lens",
    attributes=[
        {
            "name": "autofocus",
            "label": {
                "en": "Has autofocus",
                "nl": "Heeft autofocus",
            },
            "required": True,
            "type": {
                "name": "boolean",
            },
        },
        {
            "name": "lens_product_no",
            "label": {
                "en": "Lens product number",
                "nl": "Objectief productnummer",
            },
            "required": True,
            "type": {
                "name": "text",
            },
            "constraint": "Unique",
            "input_tip": {
                "en": "Enter the product code",
                "nl": "Voer de product code in",
            },
            "searchable": True,
        },
        {
            "name": "previous_model",
            "label": {
                "en": "Previous model",
                "nl": "Vorig model",
            },
            "type": {
                "name": "reference",
                "reference_type_id": "product",
            },
        },
        {
            "name": "product_properties",
            "label": {
                "en": "Product properties",
                "nl": "Product eigenschappen",
            },
            "required": False,
            "type": {
                "name": "nested",
                "type_reference": some_generic_properties_product_type.product_type_id,
            },
        },
        {
            "name": "some-flag",
            "label": {
                "en": "Some flag",
                "nl": "Een vlag",
            },
            "required": False,
            "type": {
                "name": "enum",
                "values": [
                    {
                        "key": "FLAG-1",
                        "label": "Flag 1",
                    },
                    {
                        "key": "FLAG-2",
                        "label": "FLAG-2",
                    },
                ],
            },
        },
        {
            "name": "origin",
            "label": {
                "en": "Origin country",
                "nl": "Land van herkomst",
            },
            "required": False,
            "type": {
                "name": "set",
                "element_type": {
                    "name": "lenum",
                    "localized_values": [
                        {
                            "key": "NL",
                            "label": {
                                "en": "Netherlands",
                                "nl": "Nederland",
                            },
                        },
                        {
                            "key": "DE",
                            "label": {
                                "en": "Germany",
                                "nl": "Duitsland",
                            },
                        },
                    ],
                },
            },
        },
    ])
Copy
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 {
		some_generic_properties_product_type, err := commercetools.NewProductType(ctx, "some-generic-properties-product-type", &commercetools.ProductTypeArgs{
			Key:         pulumi.String("some-key"),
			Description: pulumi.String("All the generic product properties"),
			Attributes: commercetools.ProductTypeAttributeArray{
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("perishable"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Is perishable"),
						"nl": pulumi.String("Is perishable"),
					},
					Required: pulumi.Bool(true),
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name: pulumi.String("boolean"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = commercetools.NewProductType(ctx, "my-product-type", &commercetools.ProductTypeArgs{
			Key:         pulumi.String("my-product-type-key"),
			Description: pulumi.String("All the specific info concerning the lens"),
			Attributes: commercetools.ProductTypeAttributeArray{
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("autofocus"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Has autofocus"),
						"nl": pulumi.String("Heeft autofocus"),
					},
					Required: pulumi.Bool(true),
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name: pulumi.String("boolean"),
					},
				},
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("lens_product_no"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Lens product number"),
						"nl": pulumi.String("Objectief productnummer"),
					},
					Required: pulumi.Bool(true),
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name: pulumi.String("text"),
					},
					Constraint: pulumi.String("Unique"),
					InputTip: pulumi.StringMap{
						"en": pulumi.String("Enter the product code"),
						"nl": pulumi.String("Voer de product code in"),
					},
					Searchable: pulumi.Bool(true),
				},
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("previous_model"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Previous model"),
						"nl": pulumi.String("Vorig model"),
					},
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name:            pulumi.String("reference"),
						ReferenceTypeId: pulumi.String("product"),
					},
				},
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("product_properties"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Product properties"),
						"nl": pulumi.String("Product eigenschappen"),
					},
					Required: pulumi.Bool(false),
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name:          pulumi.String("nested"),
						TypeReference: some_generic_properties_product_type.ProductTypeId,
					},
				},
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("some-flag"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Some flag"),
						"nl": pulumi.String("Een vlag"),
					},
					Required: pulumi.Bool(false),
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name: pulumi.String("enum"),
						Values: commercetools.ProductTypeAttributeTypeValueArray{
							&commercetools.ProductTypeAttributeTypeValueArgs{
								Key:   pulumi.String("FLAG-1"),
								Label: pulumi.String("Flag 1"),
							},
							&commercetools.ProductTypeAttributeTypeValueArgs{
								Key:   pulumi.String("FLAG-2"),
								Label: pulumi.String("FLAG-2"),
							},
						},
					},
				},
				&commercetools.ProductTypeAttributeArgs{
					Name: pulumi.String("origin"),
					Label: pulumi.StringMap{
						"en": pulumi.String("Origin country"),
						"nl": pulumi.String("Land van herkomst"),
					},
					Required: pulumi.Bool(false),
					Type: &commercetools.ProductTypeAttributeTypeArgs{
						Name: pulumi.String("set"),
						ElementType: &commercetools.ProductTypeAttributeTypeElementTypeArgs{
							Name: pulumi.String("lenum"),
							LocalizedValues: commercetools.ProductTypeAttributeTypeElementTypeLocalizedValueArray{
								&commercetools.ProductTypeAttributeTypeElementTypeLocalizedValueArgs{
									Key: pulumi.String("NL"),
									Label: pulumi.StringMap{
										"en": pulumi.String("Netherlands"),
										"nl": pulumi.String("Nederland"),
									},
								},
								&commercetools.ProductTypeAttributeTypeElementTypeLocalizedValueArgs{
									Key: pulumi.String("DE"),
									Label: pulumi.StringMap{
										"en": pulumi.String("Germany"),
										"nl": pulumi.String("Duitsland"),
									},
								},
							},
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Commercetools = Pulumi.Commercetools;

return await Deployment.RunAsync(() => 
{
    var some_generic_properties_product_type = new Commercetools.ProductType("some-generic-properties-product-type", new()
    {
        Key = "some-key",
        Description = "All the generic product properties",
        Attributes = new[]
        {
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "perishable",
                Label = 
                {
                    { "en", "Is perishable" },
                    { "nl", "Is perishable" },
                },
                Required = true,
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "boolean",
                },
            },
        },
    });

    var my_product_type = new Commercetools.ProductType("my-product-type", new()
    {
        Key = "my-product-type-key",
        Description = "All the specific info concerning the lens",
        Attributes = new[]
        {
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "autofocus",
                Label = 
                {
                    { "en", "Has autofocus" },
                    { "nl", "Heeft autofocus" },
                },
                Required = true,
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "boolean",
                },
            },
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "lens_product_no",
                Label = 
                {
                    { "en", "Lens product number" },
                    { "nl", "Objectief productnummer" },
                },
                Required = true,
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "text",
                },
                Constraint = "Unique",
                InputTip = 
                {
                    { "en", "Enter the product code" },
                    { "nl", "Voer de product code in" },
                },
                Searchable = true,
            },
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "previous_model",
                Label = 
                {
                    { "en", "Previous model" },
                    { "nl", "Vorig model" },
                },
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "reference",
                    ReferenceTypeId = "product",
                },
            },
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "product_properties",
                Label = 
                {
                    { "en", "Product properties" },
                    { "nl", "Product eigenschappen" },
                },
                Required = false,
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "nested",
                    TypeReference = some_generic_properties_product_type.ProductTypeId,
                },
            },
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "some-flag",
                Label = 
                {
                    { "en", "Some flag" },
                    { "nl", "Een vlag" },
                },
                Required = false,
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "enum",
                    Values = new[]
                    {
                        new Commercetools.Inputs.ProductTypeAttributeTypeValueArgs
                        {
                            Key = "FLAG-1",
                            Label = "Flag 1",
                        },
                        new Commercetools.Inputs.ProductTypeAttributeTypeValueArgs
                        {
                            Key = "FLAG-2",
                            Label = "FLAG-2",
                        },
                    },
                },
            },
            new Commercetools.Inputs.ProductTypeAttributeArgs
            {
                Name = "origin",
                Label = 
                {
                    { "en", "Origin country" },
                    { "nl", "Land van herkomst" },
                },
                Required = false,
                Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
                {
                    Name = "set",
                    ElementType = new Commercetools.Inputs.ProductTypeAttributeTypeElementTypeArgs
                    {
                        Name = "lenum",
                        LocalizedValues = new[]
                        {
                            new Commercetools.Inputs.ProductTypeAttributeTypeElementTypeLocalizedValueArgs
                            {
                                Key = "NL",
                                Label = 
                                {
                                    { "en", "Netherlands" },
                                    { "nl", "Nederland" },
                                },
                            },
                            new Commercetools.Inputs.ProductTypeAttributeTypeElementTypeLocalizedValueArgs
                            {
                                Key = "DE",
                                Label = 
                                {
                                    { "en", "Germany" },
                                    { "nl", "Duitsland" },
                                },
                            },
                        },
                    },
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.commercetools.ProductType;
import com.pulumi.commercetools.ProductTypeArgs;
import com.pulumi.commercetools.inputs.ProductTypeAttributeArgs;
import com.pulumi.commercetools.inputs.ProductTypeAttributeTypeArgs;
import com.pulumi.commercetools.inputs.ProductTypeAttributeTypeElementTypeArgs;
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 some_generic_properties_product_type = new ProductType("some-generic-properties-product-type", ProductTypeArgs.builder()
            .key("some-key")
            .description("All the generic product properties")
            .attributes(ProductTypeAttributeArgs.builder()
                .name("perishable")
                .label(Map.ofEntries(
                    Map.entry("en", "Is perishable"),
                    Map.entry("nl", "Is perishable")
                ))
                .required(true)
                .type(ProductTypeAttributeTypeArgs.builder()
                    .name("boolean")
                    .build())
                .build())
            .build());

        var my_product_type = new ProductType("my-product-type", ProductTypeArgs.builder()
            .key("my-product-type-key")
            .description("All the specific info concerning the lens")
            .attributes(            
                ProductTypeAttributeArgs.builder()
                    .name("autofocus")
                    .label(Map.ofEntries(
                        Map.entry("en", "Has autofocus"),
                        Map.entry("nl", "Heeft autofocus")
                    ))
                    .required(true)
                    .type(ProductTypeAttributeTypeArgs.builder()
                        .name("boolean")
                        .build())
                    .build(),
                ProductTypeAttributeArgs.builder()
                    .name("lens_product_no")
                    .label(Map.ofEntries(
                        Map.entry("en", "Lens product number"),
                        Map.entry("nl", "Objectief productnummer")
                    ))
                    .required(true)
                    .type(ProductTypeAttributeTypeArgs.builder()
                        .name("text")
                        .build())
                    .constraint("Unique")
                    .inputTip(Map.ofEntries(
                        Map.entry("en", "Enter the product code"),
                        Map.entry("nl", "Voer de product code in")
                    ))
                    .searchable(true)
                    .build(),
                ProductTypeAttributeArgs.builder()
                    .name("previous_model")
                    .label(Map.ofEntries(
                        Map.entry("en", "Previous model"),
                        Map.entry("nl", "Vorig model")
                    ))
                    .type(ProductTypeAttributeTypeArgs.builder()
                        .name("reference")
                        .referenceTypeId("product")
                        .build())
                    .build(),
                ProductTypeAttributeArgs.builder()
                    .name("product_properties")
                    .label(Map.ofEntries(
                        Map.entry("en", "Product properties"),
                        Map.entry("nl", "Product eigenschappen")
                    ))
                    .required(false)
                    .type(ProductTypeAttributeTypeArgs.builder()
                        .name("nested")
                        .typeReference(some_generic_properties_product_type.productTypeId())
                        .build())
                    .build(),
                ProductTypeAttributeArgs.builder()
                    .name("some-flag")
                    .label(Map.ofEntries(
                        Map.entry("en", "Some flag"),
                        Map.entry("nl", "Een vlag")
                    ))
                    .required(false)
                    .type(ProductTypeAttributeTypeArgs.builder()
                        .name("enum")
                        .values(                        
                            ProductTypeAttributeTypeValueArgs.builder()
                                .key("FLAG-1")
                                .label("Flag 1")
                                .build(),
                            ProductTypeAttributeTypeValueArgs.builder()
                                .key("FLAG-2")
                                .label("FLAG-2")
                                .build())
                        .build())
                    .build(),
                ProductTypeAttributeArgs.builder()
                    .name("origin")
                    .label(Map.ofEntries(
                        Map.entry("en", "Origin country"),
                        Map.entry("nl", "Land van herkomst")
                    ))
                    .required(false)
                    .type(ProductTypeAttributeTypeArgs.builder()
                        .name("set")
                        .elementType(ProductTypeAttributeTypeElementTypeArgs.builder()
                            .name("lenum")
                            .localizedValues(                            
                                ProductTypeAttributeTypeElementTypeLocalizedValueArgs.builder()
                                    .key("NL")
                                    .label(Map.ofEntries(
                                        Map.entry("en", "Netherlands"),
                                        Map.entry("nl", "Nederland")
                                    ))
                                    .build(),
                                ProductTypeAttributeTypeElementTypeLocalizedValueArgs.builder()
                                    .key("DE")
                                    .label(Map.ofEntries(
                                        Map.entry("en", "Germany"),
                                        Map.entry("nl", "Duitsland")
                                    ))
                                    .build())
                            .build())
                        .build())
                    .build())
            .build());

    }
}
Copy
resources:
  some-generic-properties-product-type:
    type: commercetools:ProductType
    properties:
      key: some-key
      description: All the generic product properties
      attributes:
        - name: perishable
          label:
            en: Is perishable
            nl: Is perishable
          required: true
          type:
            name: boolean
  my-product-type:
    type: commercetools:ProductType
    properties:
      key: my-product-type-key
      description: All the specific info concerning the lens
      attributes:
        - name: autofocus
          label:
            en: Has autofocus
            nl: Heeft autofocus
          required: true
          type:
            name: boolean
        - name: lens_product_no
          label:
            en: Lens product number
            nl: Objectief productnummer
          required: true
          type:
            name: text
          constraint: Unique
          inputTip:
            en: Enter the product code
            nl: Voer de product code in
          searchable: true
        - name: previous_model
          label:
            en: Previous model
            nl: Vorig model
          type:
            name: reference
            referenceTypeId: product
        - name: product_properties
          label:
            en: Product properties
            nl: Product eigenschappen
          required: false
          type:
            name: nested
            typeReference: ${["some-generic-properties-product-type"].productTypeId}
        - name: some-flag
          label:
            en: Some flag
            nl: Een vlag
          required: false
          type:
            name: enum
            values:
              - key: FLAG-1
                label: Flag 1
              - key: FLAG-2
                label: FLAG-2
        - name: origin
          label:
            en: Origin country
            nl: Land van herkomst
          required: false
          type:
            name: set
            elementType:
              name: lenum
              localizedValues:
                - key: NL
                  label:
                    en: Netherlands
                    nl: Nederland
                - key: DE
                  label:
                    en: Germany
                    nl: Duitsland
Copy

Create ProductType Resource

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

Constructor syntax

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

@overload
def ProductType(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                attributes: Optional[Sequence[ProductTypeAttributeArgs]] = None,
                description: Optional[str] = None,
                key: Optional[str] = None,
                name: Optional[str] = None,
                product_type_id: Optional[str] = None)
func NewProductType(ctx *Context, name string, args *ProductTypeArgs, opts ...ResourceOption) (*ProductType, error)
public ProductType(string name, ProductTypeArgs? args = null, CustomResourceOptions? opts = null)
public ProductType(String name, ProductTypeArgs args)
public ProductType(String name, ProductTypeArgs args, CustomResourceOptions options)
type: commercetools:ProductType
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args ProductTypeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args ProductTypeArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args ProductTypeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args ProductTypeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ProductTypeArgs
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 productTypeResource = new Commercetools.ProductType("productTypeResource", new()
{
    Attributes = new[]
    {
        new Commercetools.Inputs.ProductTypeAttributeArgs
        {
            Label = 
            {
                { "string", "string" },
            },
            Name = "string",
            Type = new Commercetools.Inputs.ProductTypeAttributeTypeArgs
            {
                Name = "string",
                ElementType = new Commercetools.Inputs.ProductTypeAttributeTypeElementTypeArgs
                {
                    Name = "string",
                    LocalizedValues = new[]
                    {
                        new Commercetools.Inputs.ProductTypeAttributeTypeElementTypeLocalizedValueArgs
                        {
                            Key = "string",
                            Label = 
                            {
                                { "string", "string" },
                            },
                        },
                    },
                    ReferenceTypeId = "string",
                    TypeReference = "string",
                    Values = new[]
                    {
                        new Commercetools.Inputs.ProductTypeAttributeTypeElementTypeValueArgs
                        {
                            Key = "string",
                            Label = "string",
                        },
                    },
                },
                LocalizedValues = new[]
                {
                    new Commercetools.Inputs.ProductTypeAttributeTypeLocalizedValueArgs
                    {
                        Key = "string",
                        Label = 
                        {
                            { "string", "string" },
                        },
                    },
                },
                ReferenceTypeId = "string",
                TypeReference = "string",
                Values = new[]
                {
                    new Commercetools.Inputs.ProductTypeAttributeTypeValueArgs
                    {
                        Key = "string",
                        Label = "string",
                    },
                },
            },
            Constraint = "string",
            InputHint = "string",
            InputTip = 
            {
                { "string", "string" },
            },
            Required = false,
            Searchable = false,
        },
    },
    Description = "string",
    Key = "string",
    Name = "string",
    ProductTypeId = "string",
});
Copy
example, err := commercetools.NewProductType(ctx, "productTypeResource", &commercetools.ProductTypeArgs{
Attributes: .ProductTypeAttributeArray{
&.ProductTypeAttributeArgs{
Label: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
Type: &.ProductTypeAttributeTypeArgs{
Name: pulumi.String("string"),
ElementType: &.ProductTypeAttributeTypeElementTypeArgs{
Name: pulumi.String("string"),
LocalizedValues: .ProductTypeAttributeTypeElementTypeLocalizedValueArray{
&.ProductTypeAttributeTypeElementTypeLocalizedValueArgs{
Key: pulumi.String("string"),
Label: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
},
ReferenceTypeId: pulumi.String("string"),
TypeReference: pulumi.String("string"),
Values: .ProductTypeAttributeTypeElementTypeValueArray{
&.ProductTypeAttributeTypeElementTypeValueArgs{
Key: pulumi.String("string"),
Label: pulumi.String("string"),
},
},
},
LocalizedValues: .ProductTypeAttributeTypeLocalizedValueArray{
&.ProductTypeAttributeTypeLocalizedValueArgs{
Key: pulumi.String("string"),
Label: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
},
ReferenceTypeId: pulumi.String("string"),
TypeReference: pulumi.String("string"),
Values: .ProductTypeAttributeTypeValueArray{
&.ProductTypeAttributeTypeValueArgs{
Key: pulumi.String("string"),
Label: pulumi.String("string"),
},
},
},
Constraint: pulumi.String("string"),
InputHint: pulumi.String("string"),
InputTip: pulumi.StringMap{
"string": pulumi.String("string"),
},
Required: pulumi.Bool(false),
Searchable: pulumi.Bool(false),
},
},
Description: pulumi.String("string"),
Key: pulumi.String("string"),
Name: pulumi.String("string"),
ProductTypeId: pulumi.String("string"),
})
Copy
var productTypeResource = new ProductType("productTypeResource", ProductTypeArgs.builder()
    .attributes(ProductTypeAttributeArgs.builder()
        .label(Map.of("string", "string"))
        .name("string")
        .type(ProductTypeAttributeTypeArgs.builder()
            .name("string")
            .elementType(ProductTypeAttributeTypeElementTypeArgs.builder()
                .name("string")
                .localizedValues(ProductTypeAttributeTypeElementTypeLocalizedValueArgs.builder()
                    .key("string")
                    .label(Map.of("string", "string"))
                    .build())
                .referenceTypeId("string")
                .typeReference("string")
                .values(ProductTypeAttributeTypeElementTypeValueArgs.builder()
                    .key("string")
                    .label("string")
                    .build())
                .build())
            .localizedValues(ProductTypeAttributeTypeLocalizedValueArgs.builder()
                .key("string")
                .label(Map.of("string", "string"))
                .build())
            .referenceTypeId("string")
            .typeReference("string")
            .values(ProductTypeAttributeTypeValueArgs.builder()
                .key("string")
                .label("string")
                .build())
            .build())
        .constraint("string")
        .inputHint("string")
        .inputTip(Map.of("string", "string"))
        .required(false)
        .searchable(false)
        .build())
    .description("string")
    .key("string")
    .name("string")
    .productTypeId("string")
    .build());
Copy
product_type_resource = commercetools.ProductType("productTypeResource",
    attributes=[{
        "label": {
            "string": "string",
        },
        "name": "string",
        "type": {
            "name": "string",
            "element_type": {
                "name": "string",
                "localized_values": [{
                    "key": "string",
                    "label": {
                        "string": "string",
                    },
                }],
                "reference_type_id": "string",
                "type_reference": "string",
                "values": [{
                    "key": "string",
                    "label": "string",
                }],
            },
            "localized_values": [{
                "key": "string",
                "label": {
                    "string": "string",
                },
            }],
            "reference_type_id": "string",
            "type_reference": "string",
            "values": [{
                "key": "string",
                "label": "string",
            }],
        },
        "constraint": "string",
        "input_hint": "string",
        "input_tip": {
            "string": "string",
        },
        "required": False,
        "searchable": False,
    }],
    description="string",
    key="string",
    name="string",
    product_type_id="string")
Copy
const productTypeResource = new commercetools.ProductType("productTypeResource", {
    attributes: [{
        label: {
            string: "string",
        },
        name: "string",
        type: {
            name: "string",
            elementType: {
                name: "string",
                localizedValues: [{
                    key: "string",
                    label: {
                        string: "string",
                    },
                }],
                referenceTypeId: "string",
                typeReference: "string",
                values: [{
                    key: "string",
                    label: "string",
                }],
            },
            localizedValues: [{
                key: "string",
                label: {
                    string: "string",
                },
            }],
            referenceTypeId: "string",
            typeReference: "string",
            values: [{
                key: "string",
                label: "string",
            }],
        },
        constraint: "string",
        inputHint: "string",
        inputTip: {
            string: "string",
        },
        required: false,
        searchable: false,
    }],
    description: "string",
    key: "string",
    name: "string",
    productTypeId: "string",
});
Copy
type: commercetools:ProductType
properties:
    attributes:
        - constraint: string
          inputHint: string
          inputTip:
            string: string
          label:
            string: string
          name: string
          required: false
          searchable: false
          type:
            elementType:
                localizedValues:
                    - key: string
                      label:
                        string: string
                name: string
                referenceTypeId: string
                typeReference: string
                values:
                    - key: string
                      label: string
            localizedValues:
                - key: string
                  label:
                    string: string
            name: string
            referenceTypeId: string
            typeReference: string
            values:
                - key: string
                  label: string
    description: string
    key: string
    name: string
    productTypeId: string
Copy

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

Attributes List<ProductTypeAttribute>
Product attribute definition
Description string
Key string
User-specific unique identifier for the product type (max. 256 characters)
Name string
ProductTypeId string
The ID of this resource.
Attributes []ProductTypeAttributeArgs
Product attribute definition
Description string
Key string
User-specific unique identifier for the product type (max. 256 characters)
Name string
ProductTypeId string
The ID of this resource.
attributes List<ProductTypeAttribute>
Product attribute definition
description String
key String
User-specific unique identifier for the product type (max. 256 characters)
name String
productTypeId String
The ID of this resource.
attributes ProductTypeAttribute[]
Product attribute definition
description string
key string
User-specific unique identifier for the product type (max. 256 characters)
name string
productTypeId string
The ID of this resource.
attributes Sequence[ProductTypeAttributeArgs]
Product attribute definition
description str
key str
User-specific unique identifier for the product type (max. 256 characters)
name str
product_type_id str
The ID of this resource.
attributes List<Property Map>
Product attribute definition
description String
key String
User-specific unique identifier for the product type (max. 256 characters)
name String
productTypeId String
The ID of this resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the ProductType 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 ProductType Resource

Get an existing ProductType 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?: ProductTypeState, opts?: CustomResourceOptions): ProductType
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attributes: Optional[Sequence[ProductTypeAttributeArgs]] = None,
        description: Optional[str] = None,
        key: Optional[str] = None,
        name: Optional[str] = None,
        product_type_id: Optional[str] = None,
        version: Optional[float] = None) -> ProductType
func GetProductType(ctx *Context, name string, id IDInput, state *ProductTypeState, opts ...ResourceOption) (*ProductType, error)
public static ProductType Get(string name, Input<string> id, ProductTypeState? state, CustomResourceOptions? opts = null)
public static ProductType get(String name, Output<String> id, ProductTypeState state, CustomResourceOptions options)
resources:  _:    type: commercetools:ProductType    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Attributes List<ProductTypeAttribute>
Product attribute definition
Description string
Key string
User-specific unique identifier for the product type (max. 256 characters)
Name string
ProductTypeId string
The ID of this resource.
Version double
Attributes []ProductTypeAttributeArgs
Product attribute definition
Description string
Key string
User-specific unique identifier for the product type (max. 256 characters)
Name string
ProductTypeId string
The ID of this resource.
Version float64
attributes List<ProductTypeAttribute>
Product attribute definition
description String
key String
User-specific unique identifier for the product type (max. 256 characters)
name String
productTypeId String
The ID of this resource.
version Double
attributes ProductTypeAttribute[]
Product attribute definition
description string
key string
User-specific unique identifier for the product type (max. 256 characters)
name string
productTypeId string
The ID of this resource.
version number
attributes Sequence[ProductTypeAttributeArgs]
Product attribute definition
description str
key str
User-specific unique identifier for the product type (max. 256 characters)
name str
product_type_id str
The ID of this resource.
version float
attributes List<Property Map>
Product attribute definition
description String
key String
User-specific unique identifier for the product type (max. 256 characters)
name String
productTypeId String
The ID of this resource.
version Number

Supporting Types

ProductTypeAttribute
, ProductTypeAttributeArgs

Label This property is required. Dictionary<string, string>
A human-readable label for the attribute
Name This property is required. string
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof
Type This property is required. ProductTypeAttributeType
AttributeType
Constraint string
Describes how an attribute or a set of attributes should be validated across all variants of a product. See also Attribute Constraint
InputHint string
Provides a visual representation type for this attribute. only relevant for text-based attribute types like TextType and LocalizableTextType
InputTip Dictionary<string, string>
Additional information about the attribute that aids content managers when setting product details
Required bool
Whether the attribute is required to have a value
Searchable bool
Whether the attribute's values should generally be activated in product search
Label This property is required. map[string]string
A human-readable label for the attribute
Name This property is required. string
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof
Type This property is required. ProductTypeAttributeType
AttributeType
Constraint string
Describes how an attribute or a set of attributes should be validated across all variants of a product. See also Attribute Constraint
InputHint string
Provides a visual representation type for this attribute. only relevant for text-based attribute types like TextType and LocalizableTextType
InputTip map[string]string
Additional information about the attribute that aids content managers when setting product details
Required bool
Whether the attribute is required to have a value
Searchable bool
Whether the attribute's values should generally be activated in product search
label This property is required. Map<String,String>
A human-readable label for the attribute
name This property is required. String
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof
type This property is required. ProductTypeAttributeType
AttributeType
constraint String
Describes how an attribute or a set of attributes should be validated across all variants of a product. See also Attribute Constraint
inputHint String
Provides a visual representation type for this attribute. only relevant for text-based attribute types like TextType and LocalizableTextType
inputTip Map<String,String>
Additional information about the attribute that aids content managers when setting product details
required Boolean
Whether the attribute is required to have a value
searchable Boolean
Whether the attribute's values should generally be activated in product search
label This property is required. {[key: string]: string}
A human-readable label for the attribute
name This property is required. string
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof
type This property is required. ProductTypeAttributeType
AttributeType
constraint string
Describes how an attribute or a set of attributes should be validated across all variants of a product. See also Attribute Constraint
inputHint string
Provides a visual representation type for this attribute. only relevant for text-based attribute types like TextType and LocalizableTextType
inputTip {[key: string]: string}
Additional information about the attribute that aids content managers when setting product details
required boolean
Whether the attribute is required to have a value
searchable boolean
Whether the attribute's values should generally be activated in product search
label This property is required. Mapping[str, str]
A human-readable label for the attribute
name This property is required. str
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof
type This property is required. ProductTypeAttributeType
AttributeType
constraint str
Describes how an attribute or a set of attributes should be validated across all variants of a product. See also Attribute Constraint
input_hint str
Provides a visual representation type for this attribute. only relevant for text-based attribute types like TextType and LocalizableTextType
input_tip Mapping[str, str]
Additional information about the attribute that aids content managers when setting product details
required bool
Whether the attribute is required to have a value
searchable bool
Whether the attribute's values should generally be activated in product search
label This property is required. Map<String>
A human-readable label for the attribute
name This property is required. String
The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). When using the same name for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an enum or lenum type and sets thereof
type This property is required. Property Map
AttributeType
constraint String
Describes how an attribute or a set of attributes should be validated across all variants of a product. See also Attribute Constraint
inputHint String
Provides a visual representation type for this attribute. only relevant for text-based attribute types like TextType and LocalizableTextType
inputTip Map<String>
Additional information about the attribute that aids content managers when setting product details
required Boolean
Whether the attribute is required to have a value
searchable Boolean
Whether the attribute's values should generally be activated in product search

ProductTypeAttributeType
, ProductTypeAttributeTypeArgs

Name This property is required. string
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
ElementType ProductTypeAttributeTypeElementType
LocalizedValues List<ProductTypeAttributeTypeLocalizedValue>
Localized values for the lenum type.
ReferenceTypeId string
Resource type the Custom Field can reference. Required when type is reference
TypeReference string
Reference to another product type. Required when type is nested.
Values List<ProductTypeAttributeTypeValue>
Values for the enum type.
Name This property is required. string
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
ElementType ProductTypeAttributeTypeElementType
LocalizedValues []ProductTypeAttributeTypeLocalizedValue
Localized values for the lenum type.
ReferenceTypeId string
Resource type the Custom Field can reference. Required when type is reference
TypeReference string
Reference to another product type. Required when type is nested.
Values []ProductTypeAttributeTypeValue
Values for the enum type.
name This property is required. String
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
elementType ProductTypeAttributeTypeElementType
localizedValues List<ProductTypeAttributeTypeLocalizedValue>
Localized values for the lenum type.
referenceTypeId String
Resource type the Custom Field can reference. Required when type is reference
typeReference String
Reference to another product type. Required when type is nested.
values List<ProductTypeAttributeTypeValue>
Values for the enum type.
name This property is required. string
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
elementType ProductTypeAttributeTypeElementType
localizedValues ProductTypeAttributeTypeLocalizedValue[]
Localized values for the lenum type.
referenceTypeId string
Resource type the Custom Field can reference. Required when type is reference
typeReference string
Reference to another product type. Required when type is nested.
values ProductTypeAttributeTypeValue[]
Values for the enum type.
name This property is required. str
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
element_type ProductTypeAttributeTypeElementType
localized_values Sequence[ProductTypeAttributeTypeLocalizedValue]
Localized values for the lenum type.
reference_type_id str
Resource type the Custom Field can reference. Required when type is reference
type_reference str
Reference to another product type. Required when type is nested.
values Sequence[ProductTypeAttributeTypeValue]
Values for the enum type.
name This property is required. String
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
elementType Property Map
localizedValues List<Property Map>
Localized values for the lenum type.
referenceTypeId String
Resource type the Custom Field can reference. Required when type is reference
typeReference String
Reference to another product type. Required when type is nested.
values List<Property Map>
Values for the enum type.

ProductTypeAttributeTypeElementType
, ProductTypeAttributeTypeElementTypeArgs

Name This property is required. string
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
LocalizedValues List<ProductTypeAttributeTypeElementTypeLocalizedValue>
Localized values for the lenum type.
ReferenceTypeId string
Resource type the Custom Field can reference. Required when type is reference
TypeReference string
Reference to another product type. Required when type is nested.
Values List<ProductTypeAttributeTypeElementTypeValue>
Values for the enum type.
Name This property is required. string
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
LocalizedValues []ProductTypeAttributeTypeElementTypeLocalizedValue
Localized values for the lenum type.
ReferenceTypeId string
Resource type the Custom Field can reference. Required when type is reference
TypeReference string
Reference to another product type. Required when type is nested.
Values []ProductTypeAttributeTypeElementTypeValue
Values for the enum type.
name This property is required. String
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
localizedValues List<ProductTypeAttributeTypeElementTypeLocalizedValue>
Localized values for the lenum type.
referenceTypeId String
Resource type the Custom Field can reference. Required when type is reference
typeReference String
Reference to another product type. Required when type is nested.
values List<ProductTypeAttributeTypeElementTypeValue>
Values for the enum type.
name This property is required. string
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
localizedValues ProductTypeAttributeTypeElementTypeLocalizedValue[]
Localized values for the lenum type.
referenceTypeId string
Resource type the Custom Field can reference. Required when type is reference
typeReference string
Reference to another product type. Required when type is nested.
values ProductTypeAttributeTypeElementTypeValue[]
Values for the enum type.
name This property is required. str
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
localized_values Sequence[ProductTypeAttributeTypeElementTypeLocalizedValue]
Localized values for the lenum type.
reference_type_id str
Resource type the Custom Field can reference. Required when type is reference
type_reference str
Reference to another product type. Required when type is nested.
values Sequence[ProductTypeAttributeTypeElementTypeValue]
Values for the enum type.
name This property is required. String
Name of the field type. Some types require extra fields to be set. Note that changing the type after creating is not supported. You need to delete the attribute and re-add it
localizedValues List<Property Map>
Localized values for the lenum type.
referenceTypeId String
Resource type the Custom Field can reference. Required when type is reference
typeReference String
Reference to another product type. Required when type is nested.
values List<Property Map>
Values for the enum type.

ProductTypeAttributeTypeElementTypeLocalizedValue
, ProductTypeAttributeTypeElementTypeLocalizedValueArgs

Key This property is required. string
Label This property is required. Dictionary<string, string>
Key This property is required. string
Label This property is required. map[string]string
key This property is required. String
label This property is required. Map<String,String>
key This property is required. string
label This property is required. {[key: string]: string}
key This property is required. str
label This property is required. Mapping[str, str]
key This property is required. String
label This property is required. Map<String>

ProductTypeAttributeTypeElementTypeValue
, ProductTypeAttributeTypeElementTypeValueArgs

Key This property is required. string
Label This property is required. string
Key This property is required. string
Label This property is required. string
key This property is required. String
label This property is required. String
key This property is required. string
label This property is required. string
key This property is required. str
label This property is required. str
key This property is required. String
label This property is required. String

ProductTypeAttributeTypeLocalizedValue
, ProductTypeAttributeTypeLocalizedValueArgs

Key This property is required. string
Label This property is required. Dictionary<string, string>
Key This property is required. string
Label This property is required. map[string]string
key This property is required. String
label This property is required. Map<String,String>
key This property is required. string
label This property is required. {[key: string]: string}
key This property is required. str
label This property is required. Mapping[str, str]
key This property is required. String
label This property is required. Map<String>

ProductTypeAttributeTypeValue
, ProductTypeAttributeTypeValueArgs

Key This property is required. string
Label This property is required. string
Key This property is required. string
Label This property is required. string
key This property is required. String
label This property is required. String
key This property is required. string
label This property is required. string
key This property is required. str
label This property is required. str
key This property is required. String
label This property is required. String

Package Details

Repository
commercetools labd/terraform-provider-commercetools
License
Notes
This Pulumi package is based on the commercetools Terraform Provider.