title: How to deploy a CloudFormation stack using CodePipeline when both, the cfn template and the pipeline where created using the AWS CDK?
body: <p>Using the AWS CDK I created a simple stack with an auto scaling group, and also define launch configuration resource to execute some powershell scripts during the ec2 instance creation. The scripts are located in the same cdk typescript project and I use and aws-s3-asset construct to upload the scripts directory. When the CDK synthtize the template it creates 3 CloudFormation parameters with autogenerated names to reference the S3 bucket of the assets. At this point every thing works perfect, I execute the cdk deploy StackWithAutoScalingGroup command, the cdk automatically populates the value of CloudFormation parameters and deploys the stack.</p>
  
  <p>I decided to implement a CodePipeline stack(StackWithTheCodePipline) to deploy the StackWithAutoScalingGroup, it fetches the code from a CodeCommit repository the executes code build to synthesize the template and as final stage it is a CodeDeploy CloudFormation action used to deploy the stack. This final step is failing because the CloudFormation params where not provided by the pipeline.</p>
  
  <p>Im looking for a way to access the s3 Assets bucket created in the StackWithAutoScalingGroup from the StackWithTheCodePipline in order to provide the required CloudFormation params </p>
  
  <p>Any help will be appreciated</p>
  
  <p>StackWithAutoScalingGroup.ts</p>
  
  <pre><code>const captivaServer = new AutoScalingGroupStandard(this, 'CaptivaServer', {
        vpc: props.vpc,
        instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO),
        machineImage: new ec2.WindowsImage(ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE),
      });
  
  const scripts = new assets.Asset(this, 'Scripts', {
  path: path.join('cfninit', 'scripts'),
  readers: [
  captivaServer.instanceRole,
  ]
  });
  </code></pre>
  
  <p>StackWithAutoScalingGroup.template.json (Parameters created afters the stack is Synthesized)</p>
  
  <pre><code>"Parameters": {
      "SsmParameterValueawsserviceamiwindowslatestWindowsServer2019EnglishFullBaseC96584B6F00A464EAD1953AFF4B05118Parameter": {
        "Type": "AWS::SSM::Parameter::Value&lt;String&gt;",
        "Default": "/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-Base"
      },
      "ScriptsS3Bucket1E273C2D": {
        "Type": "String",
        "Description": "S3 bucket for asset \"CdkCaptivaStack/Scripts\""
      },
      "ScriptsS3VersionKey0B5B668F": {
        "Type": "String",
        "Description": "S3 key for asset version \"CdkCaptivaStack/Scripts\""
      },
      "ScriptsArtifactHashC07F896B": {
        "Type": "String",
        "Description": "Artifact hash for asset \"CdkCaptivaStack/Scripts\""
      }
    }
  </code></pre>
  
  <p>StackWithTheCodePipline.ts</p>
  
  <pre><code>    new codepipeline.Pipeline(this, 'Pipeline', {
        stages: [
          {
            stageName: 'Source',
            actions: [
              new codepipeline_actions.CodeCommitSourceAction({
                actionName: 'CodeCommitSource',
                repository: code,
                output: sourceOutput,
              }),
            ],
          },
          {
            stageName: 'Build',
            actions: [
              new codepipeline_actions.CodeBuildAction({
                actionName: 'BuildStack',
                project: buildProject,
                input: sourceOutput,
                outputs: [buildOutput],
              }),
            ],
          },
          {
            stageName: 'DeployToTest',
            actions: [
              new codepipeline_actions.CloudFormationCreateUpdateStackAction({
                actionName: 'DeployStack',
                templatePath: buildOutput.atPath('StackWithAutoScalingGroup.template.json'),
                stackName: 'csg-cdk-captiva',
                //parameterOverrides: props.parameterOverrides,
                adminPermissions: true,
              }),
            ],
          },
        ],
      });
  </code></pre>
  
  <p>The action provides the parameterOverrides property to set the required parameters but like the names was autogenerated I'm not able to find a way to know the parameters that the template expect neither the value for the parameters.</p>
  
  <p>What I'm expect is a way to know the generated param names and also a way to reference the s3 assets bucket to provide the value for the parameters.</p>
  
  <pre><code>       {
            stageName: 'DeployToTest',
            actions: [
              new codepipeline_actions.CloudFormationCreateUpdateStackAction({
                actionName: 'DeployStack',
                templatePath: buildOutput.atPath('StackWithAutoScalingGroup.template.json'),
                stackName: 'csg-cdk-captiva',
                parameterOverrides: {
                     'ScriptsS3Bucket1E273C2D':????,//how I can get the param name and also the values
                     'ScriptsS3VersionKey0B5B668F':???,
                 }
                adminPermissions: true,
              }),
            ],
          },
  </code></pre>