Skip to content

Resource: awsCloudwatchEventConnection

Provides an EventBridge connection resource.

\~> Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchEventConnection.CloudwatchEventConnection(this, "test", {
  authParameters: {
    apiKey: {
      key: "x-signature",
      value: "1234",
    },
  },
  authorizationType: "API_KEY",
  description: "A connection description",
  name: "ngrok-connection",
});

Example Usage Basic Authorization

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchEventConnection.CloudwatchEventConnection(this, "test", {
  authParameters: {
    basic: {
      password: "Pass1234!",
      username: "user",
    },
  },
  authorizationType: "BASIC",
  description: "A connection description",
  name: "ngrok-connection",
});

Example Usage OAuth Authorization

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchEventConnection.CloudwatchEventConnection(this, "test", {
  authParameters: {
    oauth: {
      authorizationEndpoint: "https://auth.url.com/endpoint",
      clientParameters: {
        clientId: "1234567890",
        clientSecret: "Pass1234!",
      },
      httpMethod: "GET",
      oauthHttpParameters: {
        body: [
          {
            isValueSecret: false,
            key: "body-parameter-key",
            value: "body-parameter-value",
          },
        ],
        header: [
          {
            isValueSecret: false,
            key: "header-parameter-key",
            value: "header-parameter-value",
          },
        ],
        queryString: [
          {
            isValueSecret: false,
            key: "query-string-parameter-key",
            value: "query-string-parameter-value",
          },
        ],
      },
    },
  },
  authorizationType: "OAUTH_CLIENT_CREDENTIALS",
  description: "A connection description",
  name: "ngrok-connection",
});

Example Usage Invocation Http Parameters

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchEventConnection.CloudwatchEventConnection(this, "test", {
  authParameters: {
    basic: {
      password: "Pass1234!",
      username: "user",
    },
    invocationHttpParameters: {
      body: [
        {
          isValueSecret: false,
          key: "body-parameter-key",
          value: "body-parameter-value",
        },
        {
          isValueSecret: true,
          key: "body-parameter-key2",
          value: "body-parameter-value2",
        },
      ],
      header: [
        {
          isValueSecret: false,
          key: "header-parameter-key",
          value: "header-parameter-value",
        },
      ],
      queryString: [
        {
          isValueSecret: false,
          key: "query-string-parameter-key",
          value: "query-string-parameter-value",
        },
      ],
    },
  },
  authorizationType: "BASIC",
  description: "A connection description",
  name: "ngrok-connection",
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
  • description - (Optional) Enter a description for the connection. Maximum of 512 characters.
  • authorizationType - (Required) Choose the type of authorization to use for the connection. One of API_KEY,basic,OAUTH_CLIENT_CREDENTIALS.
  • authParameters - (Required) Parameters used for authorization. A maximum of 1 are allowed. Documented below.
  • invocationHttpParameters - (Optional) Invocation Http Parameters are additional credentials used to sign each Invocation of the ApiDestination created from this Connection. If the ApiDestination Rule Target has additional HttpParameters, the values will be merged together, with the Connection Invocation Http Parameters taking precedence. Secret values are stored and managed by AWS Secrets Manager. A maximum of 1 are allowed. Documented below.

authParameters support the following:

  • apiKey - (Optional) Parameters used for API_KEY authorization. An API key to include in the header for each authentication request. A maximum of 1 are allowed. Conflicts with basic and oauth. Documented below.
  • basic - (Optional) Parameters used for BASIC authorization. A maximum of 1 are allowed. Conflicts with apiKey and oauth. Documented below.
  • oauth - (Optional) Parameters used for OAUTH_CLIENT_CREDENTIALS authorization. A maximum of 1 are allowed. Conflicts with basic and apiKey. Documented below.

apiKey support the following:

  • key - (Required) Header Name.
  • value - (Required) Header Value. Created and stored in AWS Secrets Manager.

basic support the following:

  • username - (Required) A username for the authorization.
  • password - (Required) A password for the authorization. Created and stored in AWS Secrets Manager.

oauth support the following:

  • authorizationEndpoint - (Required) The URL to the authorization endpoint.
  • httpMethod - (Required) A password for the authorization. Created and stored in AWS Secrets Manager.
  • clientParameters - (Required) Contains the client parameters for OAuth authorization. Contains the following two parameters.
  • clientId - (Required) The client ID for the credentials to use for authorization. Created and stored in AWS Secrets Manager.
  • clientSecret - (Required) The client secret for the credentials to use for authorization. Created and stored in AWS Secrets Manager.
  • oauthHttpParameters - (Required) OAuth Http Parameters are additional credentials used to sign the request to the authorization endpoint to exchange the OAuth Client information for an access token. Secret values are stored and managed by AWS Secrets Manager. A maximum of 1 are allowed. Documented below.

invocationHttpParameters and oauthHttpParameters support the following:

  • body - (Optional) Contains additional body string parameters for the connection. You can include up to 100 additional body string parameters per request. Each additional parameter counts towards the event payload size, which cannot exceed 64 KB. Each parameter can contain the following:

    • key - (Required) The key for the parameter.
    • value - (Required) The value associated with the key. Created and stored in AWS Secrets Manager if is secret.
    • isValueSecret - (Optional) Specified whether the value is secret.
  • header - (Optional) Contains additional header parameters for the connection. You can include up to 100 additional body string parameters per request. Each additional parameter counts towards the event payload size, which cannot exceed 64 KB. Each parameter can contain the following:

    • key - (Required) The key for the parameter.
    • value - (Required) The value associated with the key. Created and stored in AWS Secrets Manager if is secret.
    • isValueSecret - (Optional) Specified whether the value is secret.
  • queryString - (Optional) Contains additional query string parameters for the connection. You can include up to 100 additional body string parameters per request. Each additional parameter counts towards the event payload size, which cannot exceed 64 KB. Each parameter can contain the following:

    • key - (Required) The key for the parameter.
    • value - (Required) The value associated with the key. Created and stored in AWS Secrets Manager if is secret.
    • isValueSecret - (Optional) Specified whether the value is secret.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) of the connection.
  • secretArn - The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.

Import

EventBridge Connection can be imported using the name, e.g.,

$ terraform import aws_cloudwatch_event_connection.test ngrok-connection