How to use the cloudform-types.CloudFormation.Stack function in cloudform-types

To help you get started, we’ve selected a few cloudform-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / util / amplifyUtils.ts View on Github external
}
    // Providing a parameter value when the parameters is not explicitly defined
    // in the template causes CloudFormation to throw an error. This will only
    // provide the value to the nested stack if the user has specified it.
    const parametersForStack = Object.keys(userDefinedStack.Parameters).reduce(
      (acc, k) => ({
        ...acc,
        [k]: customStackParams[k],
      }),
      {}
    );

    transformStacks[userStack] = userDefinedStack;
    // Split on non alphabetic characters to make a valid resource id.
    const stackResourceId = userStack.split(/[^A-Za-z]/).join('');
    const customNestedStack = new CloudFormation.Stack({
      Parameters: parametersForStack,
      TemplateURL: Fn.Join('/', [
        'https://s3.amazonaws.com',
        Fn.Ref(ResourceConstants.PARAMETERS.S3DeploymentBucket),
        Fn.Ref(ResourceConstants.PARAMETERS.S3DeploymentRootKey),
        'stacks',
        userStack,
      ]),
    }).dependsOn(allResourceIds);
    rootStack.Resources[stackResourceId] = customNestedStack;
  }

  // Update the Root Stack Params since we have added the Child Stack Params if they are missing.
  rootStack.Parameters = updatedParameters;
  return {
    ...transformOutput,
github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / util / splitStack.ts View on Github external
const stackFileNames = Object.keys(stacks);
    const allParamNames = Object.keys(root.Parameters);
    // Forward all parent parameters
    const allParamValues = allParamNames.reduce(
      (acc: any, name: string) => ({
        ...acc,
        [name]: Fn.Ref(name),
      }),
      defaultParameterValues
    );
    // Also forward the API id of the top level API.
    // allParamValues[ResourceConstants.RESOURCES.GraphQLAPILogicalID] = Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId')
    for (const stackName of stackFileNames) {
      const dependsOnStacks = stackInfo.stackDependencyMap[stackName] || [];
      const extraParams = stackInfo.stackParameterMap[stackName] || {};
      let stackResource = new CloudFormation.Stack({
        Parameters: {
          ...allParamValues,
          ...extraParams,
        },
        TemplateURL: Fn.Join('/', [
          'https://s3.amazonaws.com',
          Fn.Ref(opts.deployment.deploymentBucketParameterName),
          Fn.Ref(opts.deployment.deploymentKeyParameterName),
          'stacks',
          stackName + '.json',
        ]),
      }).dependsOn([...defaultDependencies, ...dependsOnStacks]);
      root.Resources[stackName] = stackResource;
    }
    return root;
  }