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
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",
}),
});
Content copied to clipboard
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",
}))
Content copied to clipboard
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",
}),
});
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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());
}
}
Content copied to clipboard
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
Content copied to clipboard
Import
Using pulumi import
, import aws_servicecatalog_constraint
using the constraint ID. For example:
$ pulumi import aws:servicecatalog/constraint:Constraint example cons-nmdkb6cgxfcrs
Content copied to clipboard
Properties
Link copied to clipboard
Language code. Valid values: en
(English), jp
(Japanese), zh
(Chinese). Default value is en
.
Link copied to clipboard
Description of the constraint.
Link copied to clipboard
Constraint parameters in JSON format. The syntax depends on the constraint type. See details below.
Link copied to clipboard
Portfolio identifier.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard