Skip to content

Resource: awsSchemasSchema

Provides an EventBridge Schema 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";
const awsSchemasRegistryTest = new aws.schemasRegistry.SchemasRegistry(
  this,
  "test",
  {
    name: "my_own_registry",
  }
);
const awsSchemasSchemaTest = new aws.schemasSchema.SchemasSchema(
  this,
  "test_1",
  {
    content:
      '${jsonencode({\n    "openapi" : "3.0.0",\n    "info" : {\n      "version" : "1.0.0",\n      "title" : "Event"\n    },\n    "paths" : {},\n    "components" : {\n      "schemas" : {\n        "Event" : {\n          "type" : "object",\n          "properties" : {\n            "name" : {\n              "type" : "string"\n            }\n          }\n        }\n      }\n    }\n  })}',
    description: "The schema definition for my event",
    name: "my_schema",
    registryName: awsSchemasRegistryTest.name,
    type: "OpenApi3",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSchemasSchemaTest.overrideLogicalId("test");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the schema. Maximum of 385 characters consisting of lower case letters, upper case letters, ., -, _, @.
  • content - (Required) The schema specification. Must be a valid Open API 3.0 spec.
  • registryName - (Required) The name of the registry in which this schema belongs.
  • type - (Required) The type of the schema. Valid values: openApi3.
  • description - (Optional) The description of the schema. Maximum of 256 characters.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

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

  • arn - The Amazon Resource Name (ARN) of the discoverer.
  • lastModified - The last modified date of the schema.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
  • version - The version of the schema.
  • versionCreatedDate - The created date of the version of the schema.

Import

EventBridge schema can be imported using the name and registryName, e.g.,

$ terraform import aws_schemas_schema.test name/registry