1. Packages
  2. AWS
  3. API Docs
  4. servicecatalog
  5. Constraint
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.servicecatalog.Constraint

Explore with Pulumi AI

Manages a Service Catalog Constraint.

NOTE: This resource does not associate a Service Catalog product and portfolio. However, the product and portfolio must be associated (see the aws.servicecatalog.ProductPortfolioAssociation resource) prior to creating a constraint or you will receive an error.

Example Usage

Basic Usage

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

const example = new aws.servicecatalog.Constraint("example", {
    description: "Back off, man. I'm a scientist.",
    portfolioId: exampleAwsServicecatalogPortfolio.id,
    productId: exampleAwsServicecatalogProduct.id,
    type: "LAUNCH",
    parameters: JSON.stringify({
        RoleArn: "arn:aws:iam::123456789012:role/LaunchRole",
    }),
});
Copy
import pulumi
import json
import pulumi_aws as aws

example = aws.servicecatalog.Constraint("example",
    description="Back off, man. I'm a scientist.",
    portfolio_id=example_aws_servicecatalog_portfolio["id"],
    product_id=example_aws_servicecatalog_product["id"],
    type="LAUNCH",
    parameters=json.dumps({
        "RoleArn": "arn:aws:iam::123456789012:role/LaunchRole",
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicecatalog"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"RoleArn": "arn:aws:iam::123456789012:role/LaunchRole",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = servicecatalog.NewConstraint(ctx, "example", &servicecatalog.ConstraintArgs{
			Description: pulumi.String("Back off, man. I'm a scientist."),
			PortfolioId: pulumi.Any(exampleAwsServicecatalogPortfolio.Id),
			ProductId:   pulumi.Any(exampleAwsServicecatalogProduct.Id),
			Type:        pulumi.String("LAUNCH"),
			Parameters:  pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.ServiceCatalog.Constraint("example", new()
    {
        Description = "Back off, man. I'm a scientist.",
        PortfolioId = exampleAwsServicecatalogPortfolio.Id,
        ProductId = exampleAwsServicecatalogProduct.Id,
        Type = "LAUNCH",
        Parameters = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["RoleArn"] = "arn:aws:iam::123456789012:role/LaunchRole",
        }),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.servicecatalog.Constraint;
import com.pulumi.aws.servicecatalog.ConstraintArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 example = new Constraint("example", ConstraintArgs.builder()
            .description("Back off, man. I'm a scientist.")
            .portfolioId(exampleAwsServicecatalogPortfolio.id())
            .productId(exampleAwsServicecatalogProduct.id())
            .type("LAUNCH")
            .parameters(serializeJson(
                jsonObject(
                    jsonProperty("RoleArn", "arn:aws:iam::123456789012:role/LaunchRole")
                )))
            .build());

    }
}
Copy
resources:
  example:
    type: aws:servicecatalog:Constraint
    properties:
      description: Back off, man. I'm a scientist.
      portfolioId: ${exampleAwsServicecatalogPortfolio.id}
      productId: ${exampleAwsServicecatalogProduct.id}
      type: LAUNCH
      parameters:
        fn::toJSON:
          RoleArn: arn:aws:iam::123456789012:role/LaunchRole
Copy

Create Constraint Resource

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

Constructor syntax

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

@overload
def Constraint(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               parameters: Optional[str] = None,
               portfolio_id: Optional[str] = None,
               product_id: Optional[str] = None,
               type: Optional[str] = None,
               accept_language: Optional[str] = None,
               description: Optional[str] = None)
func NewConstraint(ctx *Context, name string, args ConstraintArgs, opts ...ResourceOption) (*Constraint, error)
public Constraint(string name, ConstraintArgs args, CustomResourceOptions? opts = null)
public Constraint(String name, ConstraintArgs args)
public Constraint(String name, ConstraintArgs args, CustomResourceOptions options)
type: aws:servicecatalog:Constraint
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 This property is required. ConstraintArgs
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 This property is required. ConstraintArgs
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 This property is required. ConstraintArgs
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 This property is required. ConstraintArgs
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. ConstraintArgs
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 constraintResource = new Aws.ServiceCatalog.Constraint("constraintResource", new()
{
    Parameters = "string",
    PortfolioId = "string",
    ProductId = "string",
    Type = "string",
    AcceptLanguage = "string",
    Description = "string",
});
Copy
example, err := servicecatalog.NewConstraint(ctx, "constraintResource", &servicecatalog.ConstraintArgs{
	Parameters:     pulumi.String("string"),
	PortfolioId:    pulumi.String("string"),
	ProductId:      pulumi.String("string"),
	Type:           pulumi.String("string"),
	AcceptLanguage: pulumi.String("string"),
	Description:    pulumi.String("string"),
})
Copy
var constraintResource = new Constraint("constraintResource", ConstraintArgs.builder()
    .parameters("string")
    .portfolioId("string")
    .productId("string")
    .type("string")
    .acceptLanguage("string")
    .description("string")
    .build());
Copy
constraint_resource = aws.servicecatalog.Constraint("constraintResource",
    parameters="string",
    portfolio_id="string",
    product_id="string",
    type="string",
    accept_language="string",
    description="string")
Copy
const constraintResource = new aws.servicecatalog.Constraint("constraintResource", {
    parameters: "string",
    portfolioId: "string",
    productId: "string",
    type: "string",
    acceptLanguage: "string",
    description: "string",
});
Copy
type: aws:servicecatalog:Constraint
properties:
    acceptLanguage: string
    description: string
    parameters: string
    portfolioId: string
    productId: string
    type: string
Copy

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

Parameters This property is required. string
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
PortfolioId
This property is required.
Changes to this property will trigger replacement.
string
Portfolio identifier.
ProductId
This property is required.
Changes to this property will trigger replacement.
string
Product identifier.
Type
This property is required.
Changes to this property will trigger replacement.
string

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

AcceptLanguage string
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
Description string
Description of the constraint.
Parameters This property is required. string
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
PortfolioId
This property is required.
Changes to this property will trigger replacement.
string
Portfolio identifier.
ProductId
This property is required.
Changes to this property will trigger replacement.
string
Product identifier.
Type
This property is required.
Changes to this property will trigger replacement.
string

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

AcceptLanguage string
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
Description string
Description of the constraint.
parameters This property is required. String
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolioId
This property is required.
Changes to this property will trigger replacement.
String
Portfolio identifier.
productId
This property is required.
Changes to this property will trigger replacement.
String
Product identifier.
type
This property is required.
Changes to this property will trigger replacement.
String

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

acceptLanguage String
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description String
Description of the constraint.
parameters This property is required. string
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolioId
This property is required.
Changes to this property will trigger replacement.
string
Portfolio identifier.
productId
This property is required.
Changes to this property will trigger replacement.
string
Product identifier.
type
This property is required.
Changes to this property will trigger replacement.
string

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

acceptLanguage string
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description string
Description of the constraint.
parameters This property is required. str
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolio_id
This property is required.
Changes to this property will trigger replacement.
str
Portfolio identifier.
product_id
This property is required.
Changes to this property will trigger replacement.
str
Product identifier.
type
This property is required.
Changes to this property will trigger replacement.
str

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

accept_language str
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description str
Description of the constraint.
parameters This property is required. String
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolioId
This property is required.
Changes to this property will trigger replacement.
String
Portfolio identifier.
productId
This property is required.
Changes to this property will trigger replacement.
String
Product identifier.
type
This property is required.
Changes to this property will trigger replacement.
String

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

acceptLanguage String
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description String
Description of the constraint.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Owner string
Owner of the constraint.
Status string
Id string
The provider-assigned unique ID for this managed resource.
Owner string
Owner of the constraint.
Status string
id String
The provider-assigned unique ID for this managed resource.
owner String
Owner of the constraint.
status String
id string
The provider-assigned unique ID for this managed resource.
owner string
Owner of the constraint.
status string
id str
The provider-assigned unique ID for this managed resource.
owner str
Owner of the constraint.
status str
id String
The provider-assigned unique ID for this managed resource.
owner String
Owner of the constraint.
status String

Look up Existing Constraint Resource

Get an existing Constraint 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?: ConstraintState, opts?: CustomResourceOptions): Constraint
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        accept_language: Optional[str] = None,
        description: Optional[str] = None,
        owner: Optional[str] = None,
        parameters: Optional[str] = None,
        portfolio_id: Optional[str] = None,
        product_id: Optional[str] = None,
        status: Optional[str] = None,
        type: Optional[str] = None) -> Constraint
func GetConstraint(ctx *Context, name string, id IDInput, state *ConstraintState, opts ...ResourceOption) (*Constraint, error)
public static Constraint Get(string name, Input<string> id, ConstraintState? state, CustomResourceOptions? opts = null)
public static Constraint get(String name, Output<String> id, ConstraintState state, CustomResourceOptions options)
resources:  _:    type: aws:servicecatalog:Constraint    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:
AcceptLanguage string
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
Description string
Description of the constraint.
Owner string
Owner of the constraint.
Parameters string
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
PortfolioId Changes to this property will trigger replacement. string
Portfolio identifier.
ProductId Changes to this property will trigger replacement. string
Product identifier.
Status string
Type Changes to this property will trigger replacement. string

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

AcceptLanguage string
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
Description string
Description of the constraint.
Owner string
Owner of the constraint.
Parameters string
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
PortfolioId Changes to this property will trigger replacement. string
Portfolio identifier.
ProductId Changes to this property will trigger replacement. string
Product identifier.
Status string
Type Changes to this property will trigger replacement. string

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

acceptLanguage String
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description String
Description of the constraint.
owner String
Owner of the constraint.
parameters String
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolioId Changes to this property will trigger replacement. String
Portfolio identifier.
productId Changes to this property will trigger replacement. String
Product identifier.
status String
type Changes to this property will trigger replacement. String

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

acceptLanguage string
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description string
Description of the constraint.
owner string
Owner of the constraint.
parameters string
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolioId Changes to this property will trigger replacement. string
Portfolio identifier.
productId Changes to this property will trigger replacement. string
Product identifier.
status string
type Changes to this property will trigger replacement. string

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

accept_language str
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description str
Description of the constraint.
owner str
Owner of the constraint.
parameters str
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolio_id Changes to this property will trigger replacement. str
Portfolio identifier.
product_id Changes to this property will trigger replacement. str
Product identifier.
status str
type Changes to this property will trigger replacement. str

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

acceptLanguage String
Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.
description String
Description of the constraint.
owner String
Owner of the constraint.
parameters String
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
portfolioId Changes to this property will trigger replacement. String
Portfolio identifier.
productId Changes to this property will trigger replacement. String
Product identifier.
status String
type Changes to this property will trigger replacement. String

Type of constraint. Valid values are LAUNCH, NOTIFICATION, RESOURCE_UPDATE, STACKSET, and TEMPLATE.

The following arguments are optional:

Import

Using pulumi import, import aws_servicecatalog_constraint using the constraint ID. For example:

$ pulumi import aws:servicecatalog/constraint:Constraint example cons-nmdkb6cgxfcrs
Copy

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.