Skip to content
v2.277.0

Experimental

@aws-cdk/aws-apprunner-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

SourceConfig Struct ​

Result of binding Source into a Service.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as apprunner_alpha from '@aws-cdk/aws-apprunner-alpha';
import { aws_ecr as ecr } from 'aws-cdk-lib';

declare const gitHubConnection: apprunner_alpha.GitHubConnection;
declare const repository: ecr.Repository;
declare const runtime: apprunner_alpha.Runtime;
declare const secret: apprunner_alpha.Secret;
const sourceConfig: apprunner_alpha.SourceConfig = {
  codeRepository: {
    codeConfiguration: {
      configurationSource: apprunner_alpha.ConfigurationSourceType.REPOSITORY,

      // the properties below are optional
      configurationValues: {
        runtime: runtime,

        // the properties below are optional
        buildCommand: 'buildCommand',
        environment: {
          environmentKey: 'environment',
        },
        environmentSecrets: {
          environmentSecretsKey: secret,
        },
        environmentVariables: {
          environmentVariablesKey: 'environmentVariables',
        },
        port: 'port',
        startCommand: 'startCommand',
      },
    },
    connection: gitHubConnection,
    repositoryUrl: 'repositoryUrl',
    sourceCodeVersion: {
      type: 'type',
      value: 'value',
    },
  },
  ecrRepository: repository,
  imageRepository: {
    imageIdentifier: 'imageIdentifier',
    imageRepositoryType: apprunner_alpha.ImageRepositoryType.ECR_PUBLIC,

    // the properties below are optional
    imageConfiguration: {
      environment: {
        environmentKey: 'environment',
      },
      environmentSecrets: {
        environmentSecretsKey: secret,
      },
      environmentVariables: {
        environmentVariablesKey: 'environmentVariables',
      },
      port: 123,
      startCommand: 'startCommand',
    },
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apprunner_alpha as apprunner_alpha
from aws_cdk import aws_ecr as ecr

# git_hub_connection: apprunner_alpha.GitHubConnection
# repository: ecr.Repository
# runtime: apprunner_alpha.Runtime
# secret: apprunner_alpha.Secret

source_config = apprunner_alpha.SourceConfig(
    code_repository=apprunner_alpha.CodeRepositoryProps(
        code_configuration=apprunner_alpha.CodeConfiguration(
            configuration_source=apprunner_alpha.ConfigurationSourceType.REPOSITORY,

            # the properties below are optional
            configuration_values=apprunner_alpha.CodeConfigurationValues(
                runtime=runtime,

                # the properties below are optional
                build_command="buildCommand",
                environment={
                    "environment_key": "environment"
                },
                environment_secrets={
                    "environment_secrets_key": secret
                },
                environment_variables={
                    "environment_variables_key": "environmentVariables"
                },
                port="port",
                start_command="startCommand"
            )
        ),
        connection=git_hub_connection,
        repository_url="repositoryUrl",
        source_code_version=apprunner_alpha.SourceCodeVersion(
            type="type",
            value="value"
        )
    ),
    ecr_repository=repository,
    image_repository=apprunner_alpha.ImageRepository(
        image_identifier="imageIdentifier",
        image_repository_type=apprunner_alpha.ImageRepositoryType.ECR_PUBLIC,

        # the properties below are optional
        image_configuration=apprunner_alpha.ImageConfiguration(
            environment={
                "environment_key": "environment"
            },
            environment_secrets={
                "environment_secrets_key": secret
            },
            environment_variables={
                "environment_variables_key": "environmentVariables"
            },
            port=123,
            start_command="startCommand"
        )
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apprunner.alpha.*;
import software.amazon.awscdk.services.ecr.*;

GitHubConnection gitHubConnection;
Repository repository;
Runtime runtime;
Secret secret;

SourceConfig sourceConfig = SourceConfig.builder()
        .codeRepository(CodeRepositoryProps.builder()
                .codeConfiguration(CodeConfiguration.builder()
                        .configurationSource(ConfigurationSourceType.REPOSITORY)

                        // the properties below are optional
                        .configurationValues(CodeConfigurationValues.builder()
                                .runtime(runtime)

                                // the properties below are optional
                                .buildCommand("buildCommand")
                                .environment(Map.of(
                                        "environmentKey", "environment"))
                                .environmentSecrets(Map.of(
                                        "environmentSecretsKey", secret))
                                .environmentVariables(Map.of(
                                        "environmentVariablesKey", "environmentVariables"))
                                .port("port")
                                .startCommand("startCommand")
                                .build())
                        .build())
                .connection(gitHubConnection)
                .repositoryUrl("repositoryUrl")
                .sourceCodeVersion(SourceCodeVersion.builder()
                        .type("type")
                        .value("value")
                        .build())
                .build())
        .ecrRepository(repository)
        .imageRepository(ImageRepository.builder()
                .imageIdentifier("imageIdentifier")
                .imageRepositoryType(ImageRepositoryType.ECR_PUBLIC)

                // the properties below are optional
                .imageConfiguration(ImageConfiguration.builder()
                        .environment(Map.of(
                                "environmentKey", "environment"))
                        .environmentSecrets(Map.of(
                                "environmentSecretsKey", secret))
                        .environmentVariables(Map.of(
                                "environmentVariablesKey", "environmentVariables"))
                        .port(123)
                        .startCommand("startCommand")
                        .build())
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.AppRunner.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppRunner.Alpha;
using Amazon.CDK.AWS.ECR;

GitHubConnection gitHubConnection;
Repository repository;
Runtime runtime;
Secret secret;

var sourceConfig = new SourceConfig {
    CodeRepository = new CodeRepositoryProps {
        CodeConfiguration = new CodeConfiguration {
            ConfigurationSource = ConfigurationSourceType.REPOSITORY,

            // the properties below are optional
            ConfigurationValues = new CodeConfigurationValues {
                Runtime = runtime,

                // the properties below are optional
                BuildCommand = "buildCommand",
                Environment = new Dictionary<string, string> {
                    { "environmentKey", "environment" }
                },
                EnvironmentSecrets = new Dictionary<string, Secret> {
                    { "environmentSecretsKey", secret }
                },
                EnvironmentVariables = new Dictionary<string, string> {
                    { "environmentVariablesKey", "environmentVariables" }
                },
                Port = "port",
                StartCommand = "startCommand"
            }
        },
        Connection = gitHubConnection,
        RepositoryUrl = "repositoryUrl",
        SourceCodeVersion = new SourceCodeVersion {
            Type = "type",
            Value = "value"
        }
    },
    EcrRepository = repository,
    ImageRepository = new ImageRepository {
        ImageIdentifier = "imageIdentifier",
        ImageRepositoryType = ImageRepositoryType.ECR_PUBLIC,

        // the properties below are optional
        ImageConfiguration = new ImageConfiguration {
            Environment = new Dictionary<string, string> {
                { "environmentKey", "environment" }
            },
            EnvironmentSecrets = new Dictionary<string, Secret> {
                { "environmentSecretsKey", secret }
            },
            EnvironmentVariables = new Dictionary<string, string> {
                { "environmentVariablesKey", "environmentVariables" }
            },
            Port = 123,
            StartCommand = "startCommand"
        }
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdkapprunneralpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdkapprunneralpha"
import "github.com/aws/aws-cdk-go/awscdk"

var gitHubConnection GitHubConnection
var repository Repository
var runtime Runtime
var secret Secret

sourceConfig := &SourceConfig{
	CodeRepository: &CodeRepositoryProps{
		CodeConfiguration: &CodeConfiguration{
			ConfigurationSource: apprunner_alpha.ConfigurationSourceType_REPOSITORY,

			// the properties below are optional
			ConfigurationValues: &CodeConfigurationValues{
				Runtime: runtime,

				// the properties below are optional
				BuildCommand: jsii.String("buildCommand"),
				Environment: map[string]*string{
					"environmentKey": jsii.String("environment"),
				},
				EnvironmentSecrets: map[string]Secret{
					"environmentSecretsKey": secret,
				},
				EnvironmentVariables: map[string]*string{
					"environmentVariablesKey": jsii.String("environmentVariables"),
				},
				Port: jsii.String("port"),
				StartCommand: jsii.String("startCommand"),
			},
		},
		Connection: gitHubConnection,
		RepositoryUrl: jsii.String("repositoryUrl"),
		SourceCodeVersion: &SourceCodeVersion{
			Type: jsii.String("type"),
			Value: jsii.String("value"),
		},
	},
	EcrRepository: repository,
	ImageRepository: &ImageRepository{
		ImageIdentifier: jsii.String("imageIdentifier"),
		ImageRepositoryType: apprunner_alpha.ImageRepositoryType_ECR_PUBLIC,

		// the properties below are optional
		ImageConfiguration: &ImageConfiguration{
			Environment: map[string]*string{
				"environmentKey": jsii.String("environment"),
			},
			EnvironmentSecrets: map[string]Secret{
				"environmentSecretsKey": secret,
			},
			EnvironmentVariables: map[string]*string{
				"environmentVariablesKey": jsii.String("environmentVariables"),
			},
			Port: jsii.Number(123),
			StartCommand: jsii.String("startCommand"),
		},
	},
}

Properties ​

codeRepositoryoptionalCodeRepositoryPropscode_repositoryoptionalCodeRepositoryPropscodeRepositoryoptionalCodeRepositoryPropsCodeRepositoryoptionalCodeRepositoryPropsCodeRepositoryoptionalCodeRepositoryProps#
The code repository configuration (mutually exclusive with `imageRepository`).

Default: no code repository.

ecrRepositoryoptionalIRepositoryecr_repositoryoptionalIRepositoryecrRepositoryoptionalIRepositoryEcrRepositoryoptionalIRepositoryEcrRepositoryoptionalIRepository#
The ECR repository (required to grant the pull privileges for the iam role).

Default: no ECR repository.

imageRepositoryoptionalImageRepositoryimage_repositoryoptionalImageRepositoryimageRepositoryoptionalImageRepositoryImageRepositoryoptionalImageRepositoryImageRepositoryoptionalImageRepository#
The image repository configuration (mutually exclusive with `codeRepository`).

Default: no image repository.