Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudFormation parameter overrides and logRetention issues #8519

Closed
thovden opened this issue Jun 12, 2020 · 4 comments
Closed

CloudFormation parameter overrides and logRetention issues #8519

thovden opened this issue Jun 12, 2020 · 4 comments
Assignees
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/aws-lambda Related to AWS Lambda guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged.

Comments

@thovden
Copy link

thovden commented Jun 12, 2020

❓ General Issue

The Question

I deploy CloudFormation changesets created with CDK from CodePipeline. I use parameterOverrides to achieve this:

      const deployCommonProductionAction = new codepipelineActions.CloudFormationCreateUpdateStackAction({
            ...
            parameterOverrides: {
                ...lambdaCode.assign(serviceBuildOutput.s3Location),
            },
            extraInputs: [serviceBuildOutput],
        })

In the actual stack I get the lambda code parameters like this:

this.lambdaCode = lambda.Code.fromCfnParameters()

This all works fine in the standard case. However, when setting logRetention on a lambda in the stack, CDK creates a Lambda which uses Asset and hence our stack becomes dependent on info about the logRetention lambda code location - e.g., S3Bucket and S3VersionKey. These do not exist when deploying with CloudFormation.

Parameters:
  monitoringLambdaSourceBucketNameParameterCA784686:
    Type: String
  monitoringLambdaSourceObjectKeyParameterA7543DF9:
    Type: String
  AssetParametersceefd938ac7ea929077f2e2f4cf09b5034ebdd14799216b1281f4b28427da40aS3BucketB030C8A8:
    Type: String
    Description: S3 bucket for asset "ceefd938ac7ea929077f2e2f4cf09b5034ebdd14799216b1281f4b28427da40a"
  AssetParametersceefd938ac7ea929077f2e2f4cf09b5034ebdd14799216b1281f4b28427da40aS3VersionKey6A2AABD7:
    Type: String
    Description: S3 key for asset version "ceefd938ac7ea929077f2e2f4cf09b5034ebdd14799216b1281f4b28427da40a"
  AssetParametersceefd938ac7ea929077f2e2f4cf09b5034ebdd14799216b1281f4b28427da40aArtifactHashEDC522F0:
    Type: String
    Description: Artifact hash for asset "ceefd938ac7ea929077f2e2f4cf09b5034ebdd14799216b1281f4b28427da40a

So either I need to be able to get hold of these parameters from the logRetention lambda code, or use some other escape hatch.

I appreciate any thoughts on how to be able to use logRetention with parameterOverrides.

Environment

  • CDK CLI Version: 1.45.0
  • Module Version: 1.45.0
  • Node.js Version: 12.16.1
  • OS: OSX Catalina, Linux
  • Language (Version): Typescript 3.9.5

Other information

@thovden thovden added the needs-triage This issue or PR still needs to be triaged. label Jun 12, 2020
@SomayaB SomayaB added @aws-cdk/aws-codepipeline-actions @aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/aws-lambda Related to AWS Lambda guidance Question that needs advice or information. and removed @aws-cdk/aws-codepipeline-actions labels Jun 12, 2020
@joa44741
Copy link

I'm facing the same problem. Do you have any workaround for this?

@skinny85
Copy link
Contributor

See #3463 . Yes, we are working on this problem :).

@chrispykim
Copy link

@skinny85 I'm not sure I follow how #3463 is related to this specific issue. It's not that there's too many parameters, it's that the generated parameters point to nonexistent keys in nonexistent buckets.

Is there a workaround for using log_retention for lambdas passed through parameter overrides?

@skinny85
Copy link
Contributor

@chrispykim It is related, but in a complicated way 🙂.

Basically, our recommendation is to use the CDK Pipelines module when creating a CodePipeline for a CDK application with Assets. That module handles the Asset uploading for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/aws-lambda Related to AWS Lambda guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

5 participants