diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json deleted file mode 100644 index 9785ab36f253f..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "AWSTemplateFormatVersion" : "2010-09-09", - - "Description" : "AWS Service Catalog sample template. Creates an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", - - "Parameters" : { - "KeyName": { - "Description" : "Name of an existing EC2 key pair for SSH access to the EC2 instance.", - "Type": "AWS::EC2::KeyPair::KeyName" - }, - - "InstanceType" : { - "Description" : "EC2 instance type.", - "Type" : "String", - "Default" : "t2.micro", - "AllowedValues" : [ "t2.micro", "t2.small", "t2.medium"] - }, - - "SSHLocation" : { - "Description" : "The IP address range that can SSH to the EC2 instance.", - "Type": "String", - "MinLength": "9", - "MaxLength": "18", - "Default": "0.0.0.0/0", - "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", - "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x." - } - }, - - "Metadata" : { - "AWS::CloudFormation::Interface" : { - "ParameterGroups" : [{ - "Label" : {"default": "Instance configuration"}, - "Parameters" : ["InstanceType"] - },{ - "Label" : {"default": "Security configuration"}, - "Parameters" : ["KeyName", "SSHLocation"] - }], - "ParameterLabels" : { - "InstanceType": {"default": "Server size:"}, - "KeyName": {"default": "Key pair:"}, - "SSHLocation": {"default": "CIDR range:"} - } - } - }, - - "Mappings" : { - "AWSRegionArch2AMI" : { - "us-east-1" : { "HVM64" : "ami-08842d60" }, - "us-west-2" : { "HVM64" : "ami-8786c6b7" }, - "us-west-1" : { "HVM64" : "ami-cfa8a18a" }, - "eu-west-1" : { "HVM64" : "ami-748e2903" }, - "ap-southeast-1" : { "HVM64" : "ami-d6e1c584" }, - "ap-northeast-1" : { "HVM64" : "ami-35072834" }, - "ap-southeast-2" : { "HVM64" : "ami-fd4724c7" }, - "sa-east-1" : { "HVM64" : "ami-956cc688" }, - "cn-north-1" : { "HVM64" : "ami-ac57c595" }, - "eu-central-1" : { "HVM64" : "ami-b43503a9" } - } - - }, - - "Resources" : { - "EC2Instance" : { - "Type" : "AWS::EC2::Instance", - "Properties" : { - "InstanceType" : { "Ref" : "InstanceType" }, - "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], - "KeyName" : { "Ref" : "KeyName" }, - "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "HVM64" ] } - } - }, - - "InstanceSecurityGroup" : { - "Type" : "AWS::EC2::SecurityGroup", - "Properties" : { - "GroupDescription" : "Enable SSH access via port 22", - "SecurityGroupIngress" : [ { - "IpProtocol" : "tcp", - "FromPort" : "22", - "ToPort" : "22", - "CidrIp" : { "Ref" : "SSHLocation"} - } ] - } - } - }, - - "Outputs" : { - "PublicDNSName" : { - "Description" : "Public DNS name of the new EC2 instance", - "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] } - }, - "PublicIPAddress" : { - "Description" : "Public IP address of the new EC2 instance", - "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicIp" ] } - } - } -} diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json deleted file mode 100644 index 69c3138be93f4..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "AWSTemplateFormatVersion" : "2010-09-09", - - "Description" : "AWS Service Catalog sample template. Creates an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", - - "Parameters" : { - "KeyName": { - "Description" : "Name of an existing EC2 key pair for SSH access to the EC2 instance.", - "Type": "AWS::EC2::KeyPair::KeyName" - }, - - "InstanceType" : { - "Description" : "EC2 instance type.", - "Type" : "String", - "Default" : "t2.micro", - "AllowedValues" : [ "t2.micro", "t2.small", "t2.medium", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge" ] - }, - - "SSHLocation" : { - "Description" : "The IP address range that can SSH to the EC2 instance.", - "Type": "String", - "MinLength": "9", - "MaxLength": "18", - "Default": "0.0.0.0/0", - "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", - "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x." - } - }, - - "Metadata" : { - "AWS::CloudFormation::Interface" : { - "ParameterGroups" : [{ - "Label" : {"default": "Instance configuration"}, - "Parameters" : ["InstanceType"] - },{ - "Label" : {"default": "Security configuration"}, - "Parameters" : ["KeyName", "SSHLocation"] - }], - "ParameterLabels" : { - "InstanceType": {"default": "Server size:"}, - "KeyName": {"default": "Key pair:"}, - "SSHLocation": {"default": "CIDR range:"} - } - } - }, - - "Mappings" : { - "AWSRegionArch2AMI" : { - "us-east-1" : { "HVM64" : "ami-08842d60" }, - "us-west-2" : { "HVM64" : "ami-8786c6b7" }, - "us-west-1" : { "HVM64" : "ami-cfa8a18a" }, - "eu-west-1" : { "HVM64" : "ami-748e2903" }, - "ap-southeast-1" : { "HVM64" : "ami-d6e1c584" }, - "ap-northeast-1" : { "HVM64" : "ami-35072834" }, - "ap-southeast-2" : { "HVM64" : "ami-fd4724c7" }, - "sa-east-1" : { "HVM64" : "ami-956cc688" }, - "cn-north-1" : { "HVM64" : "ami-ac57c595" }, - "eu-central-1" : { "HVM64" : "ami-b43503a9" } - } - - }, - - "Resources" : { - "EC2Instance" : { - "Type" : "AWS::EC2::Instance", - "Properties" : { - "InstanceType" : { "Ref" : "InstanceType" }, - "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], - "KeyName" : { "Ref" : "KeyName" }, - "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "HVM64" ] } - } - }, - - "InstanceSecurityGroup" : { - "Type" : "AWS::EC2::SecurityGroup", - "Properties" : { - "GroupDescription" : "Enable SSH access via port 22", - "SecurityGroupIngress" : [ { - "IpProtocol" : "tcp", - "FromPort" : "22", - "ToPort" : "22", - "CidrIp" : { "Ref" : "SSHLocation"} - } ] - } - } - }, - - "Outputs" : { - "PublicDNSName" : { - "Description" : "Public DNS name of the new EC2 instance", - "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] } - }, - "PublicIPAddress" : { - "Description" : "Public IP address of the new EC2 instance", - "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicIp" ] } - } - } -} diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip deleted file mode 100644 index f528dc2fe5de5..0000000000000 Binary files a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip and /dev/null differ diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out index 588d7b269d34f..8ecc185e9dbee 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json index 85ba99ba49f36..5d79ca9c9aedd 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json +++ b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json @@ -66,15 +66,15 @@ } } }, - "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc": { + "5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510": { "source": { - "path": "asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip", + "path": "asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip", + "objectKey": "5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -92,20 +92,20 @@ } } }, - "95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df": { + "4083400addc1de83cd1be06b8d7b1a4f52b08ce4cbcaf1247516d9c1d7668d47": { "source": { - "path": "asset.95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip", + "path": "asset.4083400addc1de83cd1be06b8d7b1a4f52b08ce4cbcaf1247516d9c1d7668d47.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip", + "objectKey": "4083400addc1de83cd1be06b8d7b1a4f52b08ce4cbcaf1247516d9c1d7668d47.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "5a90142a26cd47112a4ae6b1bffc9a010dcd93aa3619646459686478b12576cf": { + "64975905aca20e342092cbeafd7b7c6f276ab76ba29d79a88c8ace664f6f91b4": { "source": { "path": "integ-servicecatalog-product.template.json", "packaging": "file" @@ -113,7 +113,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "5a90142a26cd47112a4ae6b1bffc9a010dcd93aa3619646459686478b12576cf.json", + "objectKey": "64975905aca20e342092cbeafd7b7c6f276ab76ba29d79a88c8ace664f6f91b4.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json index 4d34a495f2c42..2ca302f8a0a7b 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json +++ b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json @@ -1,5 +1,25 @@ { "Resources": { + "TestPortfolio4AC794EB": { + "Type": "AWS::ServiceCatalog::Portfolio", + "Properties": { + "DisplayName": "TestPortfolio", + "ProviderName": "TestProvider", + "AcceptLanguage": "en", + "Description": "This is our Service Catalog Portfolio" + } + }, + "TestPortfolioPortfolioProductAssociation9c99ebba36fc70F2C75A": { + "Type": "AWS::ServiceCatalog::PortfolioProductAssociation", + "Properties": { + "PortfolioId": { + "Ref": "TestPortfolio4AC794EB" + }, + "ProductId": { + "Ref": "TestProduct7606930B" + } + } + }, "TestAssetBucket9434EFAE": { "Type": "AWS::S3::Bucket", "Properties": { @@ -192,7 +212,8 @@ "LoadTemplateFromURL": { "Fn::Sub": "https://s3.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.json" } - } + }, + "Name": "testAssetProduct" }, { "DisableTemplateValidation": false, @@ -206,63 +227,6 @@ ] } }, - "TestProductTagOptionAssociation0d813eebb333DA3E2F21": { - "Type": "AWS::ServiceCatalog::TagOptionAssociation", - "Properties": { - "ResourceId": { - "Ref": "TestProduct7606930B" - }, - "TagOptionId": { - "Ref": "TagOptions5f31c54ba705F110F743" - } - } - }, - "TestProductTagOptionAssociation5d93a5c977b4B664DD87": { - "Type": "AWS::ServiceCatalog::TagOptionAssociation", - "Properties": { - "ResourceId": { - "Ref": "TestProduct7606930B" - }, - "TagOptionId": { - "Ref": "TagOptions8d263919cebb6764AC10" - } - } - }, - "TestProductTagOptionAssociationcfaf40b186a3E5FDECDC": { - "Type": "AWS::ServiceCatalog::TagOptionAssociation", - "Properties": { - "ResourceId": { - "Ref": "TestProduct7606930B" - }, - "TagOptionId": { - "Ref": "TagOptionsa260cbbd99c416C40F73" - } - } - }, - "TagOptions5f31c54ba705F110F743": { - "Type": "AWS::ServiceCatalog::TagOption", - "Properties": { - "Key": "key1", - "Value": "value1", - "Active": true - } - }, - "TagOptions8d263919cebb6764AC10": { - "Type": "AWS::ServiceCatalog::TagOption", - "Properties": { - "Key": "key1", - "Value": "value2", - "Active": true - } - }, - "TagOptionsa260cbbd99c416C40F73": { - "Type": "AWS::ServiceCatalog::TagOption", - "Properties": { - "Key": "key2", - "Value": "value1", - "Active": true - } - }, "AssetsBucketDeploymentAwsCliLayer9BCEE17F": { "Type": "AWS::Lambda::LayerVersion", "Properties": { @@ -270,7 +234,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip" + "S3Key": "5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip" }, "Description": "/opt/awscli/aws" } @@ -290,7 +254,7 @@ } ], "SourceObjectKeys": [ - "95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip" + "4083400addc1de83cd1be06b8d7b1a4f52b08ce4cbcaf1247516d9c1d7668d47.zip" ], "DestinationBucketName": { "Ref": "TestAssetBucket9434EFAE" @@ -452,6 +416,13 @@ } } }, + "Outputs": { + "PortfolioId": { + "Value": { + "Ref": "TestPortfolio4AC794EB" + } + } + }, "Parameters": { "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json index 5f71a052792b5..b9a1b09b515ca 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { "version": "21.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "integ-servicecatalog-product.assets": { "type": "cdk:asset-manifest", "properties": { @@ -23,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5a90142a26cd47112a4ae6b1bffc9a010dcd93aa3619646459686478b12576cf.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/64975905aca20e342092cbeafd7b7c6f276ab76ba29d79a88c8ace664f6f91b4.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -39,6 +33,18 @@ "integ-servicecatalog-product.assets" ], "metadata": { + "/integ-servicecatalog-product/TestPortfolio/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TestPortfolio4AC794EB" + } + ], + "/integ-servicecatalog-product/TestPortfolio/PortfolioProductAssociation9c99ebba36fc": [ + { + "type": "aws:cdk:logicalId", + "data": "TestPortfolioPortfolioProductAssociation9c99ebba36fc70F2C75A" + } + ], "/integ-servicecatalog-product/TestAssetBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -75,40 +81,10 @@ "data": "TestProduct7606930B" } ], - "/integ-servicecatalog-product/TestProduct/TagOptionAssociation0d813eebb333": [ - { - "type": "aws:cdk:logicalId", - "data": "TestProductTagOptionAssociation0d813eebb333DA3E2F21" - } - ], - "/integ-servicecatalog-product/TestProduct/TagOptionAssociation5d93a5c977b4": [ - { - "type": "aws:cdk:logicalId", - "data": "TestProductTagOptionAssociation5d93a5c977b4B664DD87" - } - ], - "/integ-servicecatalog-product/TestProduct/TagOptionAssociationcfaf40b186a3": [ - { - "type": "aws:cdk:logicalId", - "data": "TestProductTagOptionAssociationcfaf40b186a3E5FDECDC" - } - ], - "/integ-servicecatalog-product/TagOptions/5f31c54ba705": [ - { - "type": "aws:cdk:logicalId", - "data": "TagOptions5f31c54ba705F110F743" - } - ], - "/integ-servicecatalog-product/TagOptions/8d263919cebb": [ + "/integ-servicecatalog-product/PortfolioId": [ { "type": "aws:cdk:logicalId", - "data": "TagOptions8d263919cebb6764AC10" - } - ], - "/integ-servicecatalog-product/TagOptions/a260cbbd99c4": [ - { - "type": "aws:cdk:logicalId", - "data": "TagOptionsa260cbbd99c416C40F73" + "data": "PortfolioId" } ], "/integ-servicecatalog-product/AssetsBucketDeployment/AwsCliLayer/Resource": [ @@ -155,6 +131,12 @@ ] }, "displayName": "integ-servicecatalog-product" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/tree.json b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/tree.json index b0757100b7e3f..4529efcbae898 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/tree.json @@ -4,18 +4,56 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.140" - } - }, "integ-servicecatalog-product": { "id": "integ-servicecatalog-product", "path": "integ-servicecatalog-product", "children": { + "TestPortfolio": { + "id": "TestPortfolio", + "path": "integ-servicecatalog-product/TestPortfolio", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-servicecatalog-product/TestPortfolio/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::Portfolio", + "aws:cdk:cloudformation:props": { + "displayName": "TestPortfolio", + "providerName": "TestProvider", + "acceptLanguage": "en", + "description": "This is our Service Catalog Portfolio" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-servicecatalog.CfnPortfolio", + "version": "0.0.0" + } + }, + "PortfolioProductAssociation9c99ebba36fc": { + "id": "PortfolioProductAssociation9c99ebba36fc", + "path": "integ-servicecatalog-product/TestPortfolio/PortfolioProductAssociation9c99ebba36fc", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::PortfolioProductAssociation", + "aws:cdk:cloudformation:props": { + "portfolioId": { + "Ref": "TestPortfolio4AC794EB" + }, + "productId": { + "Ref": "TestProduct7606930B" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-servicecatalog.CfnPortfolioProductAssociation", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-servicecatalog.Portfolio", + "version": "0.0.0" + } + }, "SNSTopicProduct3": { "id": "SNSTopicProduct3", "path": "integ-servicecatalog-product/SNSTopicProduct3", @@ -396,20 +434,37 @@ }, { "disableTemplateValidation": false, - "info": {} + "info": { + "LoadTemplateFromURL": { + "Fn::Sub": "https://s3.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dd2d087eeb6ede1d2a9166639ccbde7bd1b10eef9ba2b4cb3d9855faa4fe8c1f.json" + } + } }, { "disableTemplateValidation": false, - "info": {} + "info": { + "LoadTemplateFromURL": { + "Fn::Sub": "https://s3.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dd2d087eeb6ede1d2a9166639ccbde7bd1b10eef9ba2b4cb3d9855faa4fe8c1f.json" + } + } }, { + "name": "testAssetProduct", "disableTemplateValidation": true, - "info": {} + "info": { + "LoadTemplateFromURL": { + "Fn::Sub": "https://s3.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.json" + } + } }, { "name": "v1", "disableTemplateValidation": false, - "info": {} + "info": { + "LoadTemplateFromURL": { + "Fn::Sub": "https://s3.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dd2d087eeb6ede1d2a9166639ccbde7bd1b10eef9ba2b4cb3d9855faa4fe8c1f.json" + } + } } ] } @@ -418,125 +473,390 @@ "fqn": "@aws-cdk/aws-servicecatalog.CfnCloudFormationProduct", "version": "0.0.0" } - }, - "TagOptionAssociation0d813eebb333": { - "id": "TagOptionAssociation0d813eebb333", - "path": "integ-servicecatalog-product/TestProduct/TagOptionAssociation0d813eebb333", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::TagOptionAssociation", - "aws:cdk:cloudformation:props": { - "resourceId": { - "Ref": "TestProduct7606930B" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-servicecatalog.CloudFormationProduct", + "version": "0.0.0" + } + }, + "PortfolioId": { + "id": "PortfolioId", + "path": "integ-servicecatalog-product/PortfolioId", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "AssetsBucketDeployment": { + "id": "AssetsBucketDeployment", + "path": "integ-servicecatalog-product/AssetsBucketDeployment", + "children": { + "AwsCliLayer": { + "id": "AwsCliLayer", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/AwsCliLayer", + "children": { + "Code": { + "id": "Code", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/AwsCliLayer/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/AwsCliLayer/Code/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/AwsCliLayer/Code/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } }, - "tagOptionId": { - "Ref": "TagOptions5f31c54ba705F110F743" + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/AwsCliLayer/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::LayerVersion", + "aws:cdk:cloudformation:props": { + "content": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip" + }, + "description": "/opt/awscli/aws" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnLayerVersion", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CfnTagOptionAssociation", + "fqn": "@aws-cdk/lambda-layer-awscli.AwsCliLayer", "version": "0.0.0" } }, - "TagOptionAssociation5d93a5c977b4": { - "id": "TagOptionAssociation5d93a5c977b4", - "path": "integ-servicecatalog-product/TestProduct/TagOptionAssociation5d93a5c977b4", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::TagOptionAssociation", - "aws:cdk:cloudformation:props": { - "resourceId": { - "Ref": "TestProduct7606930B" - }, - "tagOptionId": { - "Ref": "TagOptions8d263919cebb6764AC10" + "CustomResourceHandler": { + "id": "CustomResourceHandler", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/CustomResourceHandler", + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.SingletonFunction", + "version": "0.0.0" + } + }, + "Asset1": { + "id": "Asset1", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/Asset1", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/Asset1/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/Asset1/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CfnTagOptionAssociation", + "fqn": "@aws-cdk/aws-s3-assets.Asset", "version": "0.0.0" } }, - "TagOptionAssociationcfaf40b186a3": { - "id": "TagOptionAssociationcfaf40b186a3", - "path": "integ-servicecatalog-product/TestProduct/TagOptionAssociationcfaf40b186a3", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::TagOptionAssociation", - "aws:cdk:cloudformation:props": { - "resourceId": { - "Ref": "TestProduct7606930B" - }, - "tagOptionId": { - "Ref": "TagOptionsa260cbbd99c416C40F73" + "CustomResource": { + "id": "CustomResource", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/CustomResource", + "children": { + "Default": { + "id": "Default", + "path": "integ-servicecatalog-product/AssetsBucketDeployment/CustomResource/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CfnTagOptionAssociation", + "fqn": "@aws-cdk/core.CustomResource", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CloudFormationProduct", + "fqn": "@aws-cdk/aws-s3-deployment.BucketDeployment", "version": "0.0.0" } }, - "TagOptions": { - "id": "TagOptions", - "path": "integ-servicecatalog-product/TagOptions", + "Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C": { + "id": "Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C", "children": { - "5f31c54ba705": { - "id": "5f31c54ba705", - "path": "integ-servicecatalog-product/TagOptions/5f31c54ba705", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::TagOption", - "aws:cdk:cloudformation:props": { - "key": "key1", - "value": "value1", - "active": true + "ServiceRole": { + "id": "ServiceRole", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + } + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "TestAssetBucket9434EFAE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "TestAssetBucket9434EFAE", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF", + "roles": [ + { + "Ref": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Policy", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CfnTagOption", + "fqn": "@aws-cdk/aws-iam.Role", "version": "0.0.0" } }, - "8d263919cebb": { - "id": "8d263919cebb", - "path": "integ-servicecatalog-product/TagOptions/8d263919cebb", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::TagOption", - "aws:cdk:cloudformation:props": { - "key": "key1", - "value": "value2", - "active": true + "Code": { + "id": "Code", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Code/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Code/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CfnTagOption", + "fqn": "@aws-cdk/aws-s3-assets.Asset", "version": "0.0.0" } }, - "a260cbbd99c4": { - "id": "a260cbbd99c4", - "path": "integ-servicecatalog-product/TagOptions/a260cbbd99c4", + "Resource": { + "id": "Resource", + "path": "integ-servicecatalog-product/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Resource", "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceCatalog::TagOption", + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { - "key": "key2", - "value": "value1", - "active": true + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "6ddcf10002539818a9256eff3fb2b22aa09298d8f946e26ba121c175a600c44e.zip" + }, + "role": { + "Fn::GetAtt": [ + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265", + "Arn" + ] + }, + "handler": "index.handler", + "layers": [ + { + "Ref": "AssetsBucketDeploymentAwsCliLayer9BCEE17F" + } + ], + "runtime": "python3.9", + "timeout": 900 } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.CfnTagOption", + "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-servicecatalog.TagOptions", + "fqn": "@aws-cdk/aws-lambda.Function", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-servicecatalog-product/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-servicecatalog-product/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", "version": "0.0.0" } } @@ -545,6 +865,14 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.154" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts index c9159dd85cf9b..7362b8885e53c 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts +++ b/packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts @@ -6,6 +6,59 @@ import * as cdk from '@aws-cdk/core'; import * as servicecatalog from '../lib'; import { ProductStackHistory, ProductStackProps } from '../lib'; +/** + * Follow these instructions to manually test provisioning a Product with an Asset with the resources provisioned in this stack: + * + * 1. Deploy the stack: + ``` + $ cdk deploy --app "node integ.product.js" integ-servicecatalog-product + ``` + * + * 2. Obtain IAM Principal ARN that will provision product. + One way this can be done is by using + ``` + $ aws sts get-caller-identity + ``` + * + * 3. Associate your principal to your portfolio. PortfolioId is stored as an output values from the deployed stack. + ``` + $ aws servicecatalog associate-principal-with-portfolio \ + --portfolio-id= \ + --principal-arn= \ + --principal-type=IAM + ``` + * + * 4. Provision Product using the following prefilled values. + ``` + $ aws servicecatalog provision-product \ + --provisioned-product-name=testAssetProvisioningProduct \ + --product-name=testProduct \ + --provisioning-artifact-name=testAssetProduct + ``` + * + * 5. Verify Provision Product was provisioned providing the ProvisionedProductId from the previous step. + ``` + $ aws servicecatalog describe-provisioned-product --id= + ``` + * + * 6. Terminate Provisioned Product providing the ProvisionedProductId from the previous step. + ``` + $ aws servicecatalog terminate-provisioned-product --provisioned-product-id= + ``` + * + * 7. Disassociate your principal from your portfolio. + ``` + $ aws servicecatalog disassociate-principal-with-portfolio \ + --portfolio-id= \ + --principal-arn= \ + ``` + * + * 8. Destroy the stack: + ``` + $ cdk destroy --app "node integ.product.js" integ-servicecatalog-product + ``` + */ + const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-servicecatalog-product'); @@ -17,6 +70,13 @@ class TestProductStack extends servicecatalog.ProductStack { } } +const portfolio = new servicecatalog.Portfolio(stack, 'TestPortfolio', { + displayName: 'TestPortfolio', + providerName: 'TestProvider', + description: 'This is our Service Catalog Portfolio', + messageLanguage: servicecatalog.MessageLanguage.EN, +}); + class TestAssetProductStack extends servicecatalog.ProductStack { constructor(scope: any, id: string, props?: ProductStackProps) { super(scope, id, props); @@ -30,7 +90,7 @@ class TestAssetProductStack extends servicecatalog.ProductStack { const productStackHistory = new ProductStackHistory(stack, 'ProductStackHistory', { productStack: new TestProductStack(stack, 'SNSTopicProduct3'), currentVersionName: 'v1', - currentVersionLocked: true, + currentVersionLocked: false, }); const testAssetBucket = new s3.Bucket(stack, 'TestAssetBucket', { @@ -61,6 +121,7 @@ const product = new servicecatalog.CloudFormationProduct(stack, 'TestProduct', { cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new TestProductStack(stack, 'SNSTopicProduct2')), }, { + productVersionName: 'testAssetProduct', validateTemplate: false, cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new TestAssetProductStack(stack, 'S3AssetProduct', { assetBucket: testAssetBucket, @@ -70,13 +131,8 @@ const product = new servicecatalog.CloudFormationProduct(stack, 'TestProduct', { ], }); -const tagOptions = new servicecatalog.TagOptions(stack, 'TagOptions', { - allowedValuesForTags: { - key1: ['value1', 'value2'], - key2: ['value1'], - }, -}); +portfolio.addProduct(product); -product.associateTagOptions(tagOptions); +new cdk.CfnOutput(stack, 'PortfolioId', { value: portfolio.portfolioId }); app.synth();