1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. servicecatalog
  5. PrincipalPortfolioAssociation
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.servicecatalog.PrincipalPortfolioAssociation

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides a Service Catalog Principal Portfolio Association resource.

    Principal portfolio association.

    For information about Service Catalog Principal Portfolio Association and how to use it, see What is Principal Portfolio Association.

    NOTE: Available since v1.230.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const defaultDaXVxI = new alicloud.servicecatalog.Portfolio("defaultDaXVxI", {
        providerName: name,
        description: "desc",
        portfolioName: name,
    });
    const default48JHf4 = new alicloud.ram.Role("default48JHf4", {
        name: name,
        document: `    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    `,
        description: "this is a role test.",
        force: true,
    });
    const _default = new alicloud.servicecatalog.PrincipalPortfolioAssociation("default", {
        principalId: default48JHf4.id,
        portfolioId: defaultDaXVxI.id,
        principalType: "RamRole",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default_da_x_vx_i = alicloud.servicecatalog.Portfolio("defaultDaXVxI",
        provider_name=name,
        description="desc",
        portfolio_name=name)
    default48_j_hf4 = alicloud.ram.Role("default48JHf4",
        name=name,
        document="""    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    """,
        description="this is a role test.",
        force=True)
    default = alicloud.servicecatalog.PrincipalPortfolioAssociation("default",
        principal_id=default48_j_hf4.id,
        portfolio_id=default_da_x_vx_i.id,
        principal_type="RamRole")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/servicecatalog"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultDaXVxI, err := servicecatalog.NewPortfolio(ctx, "defaultDaXVxI", &servicecatalog.PortfolioArgs{
    			ProviderName:  pulumi.String(name),
    			Description:   pulumi.String("desc"),
    			PortfolioName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		default48JHf4, err := ram.NewRole(ctx, "default48JHf4", &ram.RoleArgs{
    			Name: pulumi.String(name),
    			Document: pulumi.String(`    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    `),
    			Description: pulumi.String("this is a role test."),
    			Force:       pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = servicecatalog.NewPrincipalPortfolioAssociation(ctx, "default", &servicecatalog.PrincipalPortfolioAssociationArgs{
    			PrincipalId:   default48JHf4.ID(),
    			PortfolioId:   defaultDaXVxI.ID(),
    			PrincipalType: pulumi.String("RamRole"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var defaultDaXVxI = new AliCloud.ServiceCatalog.Portfolio("defaultDaXVxI", new()
        {
            ProviderName = name,
            Description = "desc",
            PortfolioName = name,
        });
    
        var default48JHf4 = new AliCloud.Ram.Role("default48JHf4", new()
        {
            Name = name,
            Document = @"    {
            ""Statement"": [
            {
                ""Action"": ""sts:AssumeRole"",
                ""Effect"": ""Allow"",
                ""Principal"": {
                ""Service"": [
                    ""emr.aliyuncs.com"",
                    ""ecs.aliyuncs.com""
                ]
                }
            }
            ],
            ""Version"": ""1""
        }
    ",
            Description = "this is a role test.",
            Force = true,
        });
    
        var @default = new AliCloud.ServiceCatalog.PrincipalPortfolioAssociation("default", new()
        {
            PrincipalId = default48JHf4.Id,
            PortfolioId = defaultDaXVxI.Id,
            PrincipalType = "RamRole",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.servicecatalog.Portfolio;
    import com.pulumi.alicloud.servicecatalog.PortfolioArgs;
    import com.pulumi.alicloud.ram.Role;
    import com.pulumi.alicloud.ram.RoleArgs;
    import com.pulumi.alicloud.servicecatalog.PrincipalPortfolioAssociation;
    import com.pulumi.alicloud.servicecatalog.PrincipalPortfolioAssociationArgs;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var defaultDaXVxI = new Portfolio("defaultDaXVxI", PortfolioArgs.builder()
                .providerName(name)
                .description("desc")
                .portfolioName(name)
                .build());
    
            var default48JHf4 = new Role("default48JHf4", RoleArgs.builder()
                .name(name)
                .document("""
        {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
                """)
                .description("this is a role test.")
                .force(true)
                .build());
    
            var default_ = new PrincipalPortfolioAssociation("default", PrincipalPortfolioAssociationArgs.builder()
                .principalId(default48JHf4.id())
                .portfolioId(defaultDaXVxI.id())
                .principalType("RamRole")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultDaXVxI:
        type: alicloud:servicecatalog:Portfolio
        properties:
          providerName: ${name}
          description: desc
          portfolioName: ${name}
      default48JHf4:
        type: alicloud:ram:Role
        properties:
          name: ${name}
          document: |2
                {
                    "Statement": [
                    {
                        "Action": "sts:AssumeRole",
                        "Effect": "Allow",
                        "Principal": {
                        "Service": [
                            "emr.aliyuncs.com",
                            "ecs.aliyuncs.com"
                        ]
                        }
                    }
                    ],
                    "Version": "1"
                }
          description: this is a role test.
          force: true
      default:
        type: alicloud:servicecatalog:PrincipalPortfolioAssociation
        properties:
          principalId: ${default48JHf4.id}
          portfolioId: ${defaultDaXVxI.id}
          principalType: RamRole
    

    Create PrincipalPortfolioAssociation Resource

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

    Constructor syntax

    new PrincipalPortfolioAssociation(name: string, args: PrincipalPortfolioAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def PrincipalPortfolioAssociation(resource_name: str,
                                      args: PrincipalPortfolioAssociationArgs,
                                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def PrincipalPortfolioAssociation(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      portfolio_id: Optional[str] = None,
                                      principal_id: Optional[str] = None,
                                      principal_type: Optional[str] = None)
    func NewPrincipalPortfolioAssociation(ctx *Context, name string, args PrincipalPortfolioAssociationArgs, opts ...ResourceOption) (*PrincipalPortfolioAssociation, error)
    public PrincipalPortfolioAssociation(string name, PrincipalPortfolioAssociationArgs args, CustomResourceOptions? opts = null)
    public PrincipalPortfolioAssociation(String name, PrincipalPortfolioAssociationArgs args)
    public PrincipalPortfolioAssociation(String name, PrincipalPortfolioAssociationArgs args, CustomResourceOptions options)
    
    type: alicloud:servicecatalog:PrincipalPortfolioAssociation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PrincipalPortfolioAssociationArgs
    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 PrincipalPortfolioAssociationArgs
    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 PrincipalPortfolioAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PrincipalPortfolioAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PrincipalPortfolioAssociationArgs
    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 principalPortfolioAssociationResource = new AliCloud.ServiceCatalog.PrincipalPortfolioAssociation("principalPortfolioAssociationResource", new()
    {
        PortfolioId = "string",
        PrincipalId = "string",
        PrincipalType = "string",
    });
    
    example, err := servicecatalog.NewPrincipalPortfolioAssociation(ctx, "principalPortfolioAssociationResource", &servicecatalog.PrincipalPortfolioAssociationArgs{
    	PortfolioId:   pulumi.String("string"),
    	PrincipalId:   pulumi.String("string"),
    	PrincipalType: pulumi.String("string"),
    })
    
    var principalPortfolioAssociationResource = new PrincipalPortfolioAssociation("principalPortfolioAssociationResource", PrincipalPortfolioAssociationArgs.builder()
        .portfolioId("string")
        .principalId("string")
        .principalType("string")
        .build());
    
    principal_portfolio_association_resource = alicloud.servicecatalog.PrincipalPortfolioAssociation("principalPortfolioAssociationResource",
        portfolio_id="string",
        principal_id="string",
        principal_type="string")
    
    const principalPortfolioAssociationResource = new alicloud.servicecatalog.PrincipalPortfolioAssociation("principalPortfolioAssociationResource", {
        portfolioId: "string",
        principalId: "string",
        principalType: "string",
    });
    
    type: alicloud:servicecatalog:PrincipalPortfolioAssociation
    properties:
        portfolioId: string
        principalId: string
        principalType: string
    

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

    PortfolioId string
    Product Portfolio ID
    PrincipalId string
    RAM entity ID
    PrincipalType string
    RAM entity type
    PortfolioId string
    Product Portfolio ID
    PrincipalId string
    RAM entity ID
    PrincipalType string
    RAM entity type
    portfolioId String
    Product Portfolio ID
    principalId String
    RAM entity ID
    principalType String
    RAM entity type
    portfolioId string
    Product Portfolio ID
    principalId string
    RAM entity ID
    principalType string
    RAM entity type
    portfolio_id str
    Product Portfolio ID
    principal_id str
    RAM entity ID
    principal_type str
    RAM entity type
    portfolioId String
    Product Portfolio ID
    principalId String
    RAM entity ID
    principalType String
    RAM entity type

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing PrincipalPortfolioAssociation Resource

    Get an existing PrincipalPortfolioAssociation 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?: PrincipalPortfolioAssociationState, opts?: CustomResourceOptions): PrincipalPortfolioAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            portfolio_id: Optional[str] = None,
            principal_id: Optional[str] = None,
            principal_type: Optional[str] = None) -> PrincipalPortfolioAssociation
    func GetPrincipalPortfolioAssociation(ctx *Context, name string, id IDInput, state *PrincipalPortfolioAssociationState, opts ...ResourceOption) (*PrincipalPortfolioAssociation, error)
    public static PrincipalPortfolioAssociation Get(string name, Input<string> id, PrincipalPortfolioAssociationState? state, CustomResourceOptions? opts = null)
    public static PrincipalPortfolioAssociation get(String name, Output<String> id, PrincipalPortfolioAssociationState 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:
    PortfolioId string
    Product Portfolio ID
    PrincipalId string
    RAM entity ID
    PrincipalType string
    RAM entity type
    PortfolioId string
    Product Portfolio ID
    PrincipalId string
    RAM entity ID
    PrincipalType string
    RAM entity type
    portfolioId String
    Product Portfolio ID
    principalId String
    RAM entity ID
    principalType String
    RAM entity type
    portfolioId string
    Product Portfolio ID
    principalId string
    RAM entity ID
    principalType string
    RAM entity type
    portfolio_id str
    Product Portfolio ID
    principal_id str
    RAM entity ID
    principal_type str
    RAM entity type
    portfolioId String
    Product Portfolio ID
    principalId String
    RAM entity ID
    principalType String
    RAM entity type

    Import

    Service Catalog Principal Portfolio Association can be imported using the id, e.g.

    $ pulumi import alicloud:servicecatalog/principalPortfolioAssociation:PrincipalPortfolioAssociation example <principal_id>:<principal_type>:<portfolio_id>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi