Closed sdmain closed 4 years ago
@sdmain thanks for opening this bug report. I think that's related to this issue, which will be tackled soon. In the meantime, you can use escape hatches as described in one of the issue comments as well. Hope that'll unblock you.
Let me know if there's anything unclear. Otherwise, please confirm it's working for you after testing the workaround.
Thanks Sebastian! I will try that right now and will share the outcome.
One side question - at what point can we propose CDK for Terraform for production usage for our customers?
@sdmain CDK for Terraform is in alpha as we gather more feedback about the project and the feature set. We will announce a stable version when we are confident that the project is ready for supporting production stacks. Please continue to give us feedback as we go through this process. Thank you for using CDK for Terraform. :)
@skorfmann I think I am a bit lost here. I have configuration defined for each stage within the pipeline. If I add pipeline.addOverride('configuration'..), I am not sure how that would work.
or I am thinking I should provide those specific configurations in override, but 'RepositoryName' and 'BranchName' are already supported parameters in native Terraform for 'CodeCommit' provider.
stage: [
{name: 'sourceStage', action: [
{name: 'sourceAction',
owner: 'AWS',
category: 'Source',
provider: 'CodeCommit',
version: '1',
outputArtifacts: ['source_output'],
configuration:{'RepositoryName':'myappRepoSampleApp', 'BranchName': 'master'} //**ERROR**
}
]},
tried these overrides:
pipeline.addOverride('configuration', {'RepositoryName':'myappRepoSampleApp'});
pipeline.addOverride('configuration', {'BranchName':'master'});
Error: Extraneous JSON object property
on cdk.tf.json line 362, in resource.aws_codepipeline.typescriptawsaz_fnmaPipeline_2BF044C5: 362: "configuration": {
No argument or block type is named "configuration".
or I am thinking I should provide those specific configurations in override, but 'RepositoryName' and 'BranchName' are already supported parameters in native Terraform for 'CodeCommit' provider.
I think this takes an arbitrary object and passes it directly through to the AWS API. The issue is, that we automatically convert all object keys to snake case, and the AWS API doesn't expect it that way. See here the provider docs https://registry.terraform.io/providers/hashicorp/aws/2.70.0/docs/resources/codepipeline#configuration
pipeline.addOverride('configuration', {'RepositoryName':'fnmaRepoSampleApp'});
The override takes a JSON path as well. Something like this could work pipeline.addOverride('stage.0.action.0.configuration', {'RepositoryName':'fnmaRepoSampleApp', 'BranchName': 'foo'});
@skorfmann unfortunately this did not work. I am stuck at this error for a few hours now. I made a lot of progress with several other resources, but this specific error with codepipeline is killing me :(
pipeline.addOverride('stage.0.action.0.configuration', {'RepositoryName':'myappRepoSampleApp', 'BranchName': 'master'});
Error: Error creating CodePipeline: InvalidActionDeclarationException: Action configuration for action 'sourceAction' contains unknown configuration 'repository_name'
on cdk.tf.json line 385, in resource.aws_codepipeline.typescriptawsa
Let me quickly check
pipeline.addOverride('stage.0.action.0.configuration', {'RepositoryName':'myappRepoSampleApp', 'BranchName': 'master'});
Looks like addOverride
is merging, not completely overwriting. I think that's on purpose, to allow partial overwrites. In this particular case this behaviour is not ideal though. When you remove the configuration
block in the resource class itself, it should work.
Thank you! Trying it now
@skorfmann That worked!!! Thanks a bunch!!! I am unblocked with that error now.
That worked!!! Thanks a bunch!!! I am unblocked with that error now.
Cool, no worries - thanks for confirming. I'll close this issue as duplicate. If there's anything else, don't hesitate to create another issue.
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
cdktf & Language Versions
Affected Resource(s)
CodePipeline - Source stage - CodeCommit 'configuration'
For sourceStage, I am unable to provide configuration for CodeCommit: configuration parameters 'RepositoyName' and 'BranchName' are not recognized by CDK for Terraform.
Debug Output
Expected Behavior
CodePipeline should be created without erroring out on CodeCommit configuration
Actual Behavior
Steps to Reproduce
Code: Below is my main.ts code snippet.
Important Factoids
References
0000