AWS Classic

v5.21.1 published on Thursday, Nov 17, 2022 by Pulumi

Constraint

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

using System.Collections.Generic;
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 = aws_servicecatalog_portfolio.Example.Id,
        ProductId = aws_servicecatalog_product.Example.Id,
        Type = "LAUNCH",
        Parameters = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["RoleArn"] = "arn:aws:iam::123456789012:role/LaunchRole",
        }),
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v5/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(aws_servicecatalog_portfolio.Example.Id),
			ProductId:   pulumi.Any(aws_servicecatalog_product.Example.Id),
			Type:        pulumi.String("LAUNCH"),
			Parameters:  pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.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(aws_servicecatalog_portfolio.example().id())
            .productId(aws_servicecatalog_product.example().id())
            .type("LAUNCH")
            .parameters(serializeJson(
                jsonObject(
                    jsonProperty("RoleArn", "arn:aws:iam::123456789012:role/LaunchRole")
                )))
            .build());

    }
}
import pulumi
import json
import pulumi_aws as aws

example = aws.servicecatalog.Constraint("example",
    description="Back off, man. I'm a scientist.",
    portfolio_id=aws_servicecatalog_portfolio["example"]["id"],
    product_id=aws_servicecatalog_product["example"]["id"],
    type="LAUNCH",
    parameters=json.dumps({
        "RoleArn": "arn:aws:iam::123456789012:role/LaunchRole",
    }))
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: aws_servicecatalog_portfolio.example.id,
    productId: aws_servicecatalog_product.example.id,
    type: "LAUNCH",
    parameters: JSON.stringify({
        RoleArn: "arn:aws:iam::123456789012:role/LaunchRole",
    }),
});
resources:
  example:
    type: aws:servicecatalog:Constraint
    properties:
      description: Back off, man. I'm a scientist.
      portfolioId: ${aws_servicecatalog_portfolio.example.id}
      productId: ${aws_servicecatalog_product.example.id}
      type: LAUNCH
      parameters:
        Fn::ToJSON:
          RoleArn: arn:aws:iam::123456789012:role/LaunchRole

Create Constraint Resource

new Constraint(name: string, args: ConstraintArgs, opts?: CustomResourceOptions);
@overload
def Constraint(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               accept_language: Optional[str] = None,
               description: Optional[str] = None,
               parameters: Optional[str] = None,
               portfolio_id: Optional[str] = None,
               product_id: Optional[str] = None,
               type: Optional[str] = None)
@overload
def Constraint(resource_name: str,
               args: ConstraintArgs,
               opts: Optional[ResourceOptions] = 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.

name string
The unique name of the resource.
args ConstraintArgs
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 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 string
The unique name of the resource.
args ConstraintArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ConstraintArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ConstraintArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

The Constraint resource accepts the following input properties:

Parameters string

Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.

PortfolioId string

Portfolio identifier.

ProductId string

Product identifier.

Type string

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

AcceptLanguage string

Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.

Description string

Description of the constraint.

Parameters string

Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.

PortfolioId string

Portfolio identifier.

ProductId string

Product identifier.

Type string

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

AcceptLanguage string

Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.

Description string

Description of the constraint.

parameters String

Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.

portfolioId String

Portfolio identifier.

productId String

Product identifier.

type String

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

acceptLanguage String

Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.

description String

Description of the constraint.

parameters string

Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.

portfolioId string

Portfolio identifier.

productId string

Product identifier.

type string

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

acceptLanguage string

Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.

description string

Description of the constraint.

parameters str

Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.

portfolio_id str

Portfolio identifier.

product_id str

Product identifier.

type str

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

accept_language str

Language code. Valid values: en (English), jp (Japanese), zh (Chinese). Default value is en.

description str

Description of the constraint.

parameters String

Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.

portfolioId String

Portfolio identifier.

productId String

Product identifier.

type String

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

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)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
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 string

Portfolio identifier.

ProductId string

Product identifier.

Status string
Type string

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

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 string

Portfolio identifier.

ProductId string

Product identifier.

Status string
Type string

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

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 String

Portfolio identifier.

productId String

Product identifier.

status String
type String

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

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 string

Portfolio identifier.

productId string

Product identifier.

status string
type string

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

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 str

Portfolio identifier.

product_id str

Product identifier.

status str
type str

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

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 String

Portfolio identifier.

productId String

Product identifier.

status String
type String

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

Import

aws_servicecatalog_constraint can be imported using the constraint ID, e.g.,

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

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.