I have started my cdk, somedays ago and having this problem from 1-2 days. If someone could give insights it would be very helpful
Following is the code for the pipeline and receiving error:
throw new Error(‘Trying to resolve() a Construct at ‘ + pathName);
export class AppConfigCiCdStack extends Stack {
private application: CfnApplication;
private environments: CfnEnvironment;
private deploymentStrategy: CfnDeploymentStrategy;
private bucket: Bucket;
private profile: CfnConfigurationProfile
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
this.application = new CfnApplication(this, "ServerlessApplication", {
description: "ConFiguration For Serverless Application",
name: "ServerlessApplicationConfig"
});
this.environments = new CfnEnvironment(this, "Testing", {
description: "Testing environment for app",
name : "Test",
applicationId : this.application.ref,
});
this.profile = new CfnConfigurationProfile(this, "LoggingConfiguration", {
applicationId: this.application.ref,
description : "Logging related configuration",
name: "LoggingConfiguration",
locationUri: `s3://${this.bucket}sampleApp.zip/`
})
this.bucket = new Bucket(this, 'source', {
bucketName: 'source',
versioned: true,
})
this.deploymentStrategy = new CfnDeploymentStrategy(this, "DeploymentStrategy", {
deploymentDurationInMinutes : 0,
finalBakeTimeInMinutes: 1,
growthType: "LINEAR",
growthFactor: 100,
name: "Custom.Immediate.Bake5Minutes",
replicateTo: "NONE",
})
this.pipeline(this.bucket, this.application, this.environments, this.deploymentStrategy, this.profile);
}
pipeline(bucket: Bucket, application: CfnApplication, environments: CfnEnvironment, strategy: CfnDeploymentStrategy, profile: CfnConfigurationProfile) {
const pipelineArtifact = new Bucket(this, "serverlessappconfigpipelineartifact", {
bucketName: "serverlessappconfigpipelineartifact",
versioned: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
})
const sourceConfig = {"Application": application.ref, "Bucket": bucket, "S3ObjectKey": 'sampleApp.zip'};
const outputArtifactProperty: CfnPipeline.OutputArtifactProperty = {
name: 'sourceConfig',
};
const inputArtifactProperty: CfnPipeline.InputArtifactProperty = {
name: 'sourceConfig',
};
const configSource : CfnPipeline.ActionDeclarationProperty = {
actionTypeId: {
category: "Source",
owner: "AWS",
provider: "S3",
version: "1",
},
configuration: {
sourceConfig,
},
name: "ServerlessAppConfigSource",
outputArtifacts: [outputArtifactProperty],
}
const sourceStage: CfnPipeline.StageDeclarationProperty = {
name: "Source",
actions: [configSource],
}
const deployConfig = { "Application": application.ref,
"Environment": environments.ref,
"ConfigurationProfile": profile.ref,
"DeploymentStrategy": strategy.ref,
"InputArtifactConfigurationPath": 'sampleApp.json'};
const appConfigDeploy: CfnPipeline.ActionDeclarationProperty = {
actionTypeId: {
category: "Deploy",
owner: "AWS",
provider: "AppConfig",
version: '1',
},
inputArtifacts: [inputArtifactProperty],
configuration: deployConfig,
name: "ServerlessAppConfigDeploy",
}
const deployStage : CfnPipeline.StageDeclarationProperty = {
name: "Deploy",
actions: [appConfigDeploy],
}
const artifactStoreProperty: CfnPipeline.ArtifactStoreProperty = {
location: pipelineArtifact.bucketName,
type: "S3",
}
const pipeline = new CfnPipeline(this, "ServerlessAppConfigPipeline", {
stages: [sourceStage, deployStage],
artifactStore: artifactStoreProperty,
roleArn: '',
name: 'ServerlessAppConfigPipeline'
})
}
}
error: throw new Error(‘Trying to resolve() a Construct at ‘ + pathName);