Skip to content

Resource: awsOpsworksApplication

Provides an OpsWorks application resource.

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.opsworksApplication.OpsworksApplication(this, "foo-app", {
  appSource: [
    {
      revision: "master",
      type: "git",
      url: "https://github.com/example.git",
    },
  ],
  autoBundleOnDeploy: true,
  description: "This is a Rails application",
  documentRoot: "public",
  domains: ["example.com", "sub.example.com"],
  enableSsl: true,
  environment: [
    {
      key: "key",
      secure: false,
      value: "value",
    },
  ],
  name: "foobar application",
  railsEnv: "staging",
  shortName: "foobar",
  sslConfiguration: [
    {
      certificate: '${file("./foobar.crt")}',
      privateKey: '${file("./foobar.key")}',
    },
  ],
  stackId: "${aws_opsworks_stack.main.id}",
  type: "rails",
});

Argument Reference

The following arguments are supported:

  • name - (Required) A human-readable name for the application.
  • shortName - (Required) A short, machine-readable name for the application. This can only be defined on resource creation and ignored on resource update.
  • stackId - (Required) ID of the stack the application will belong to.
  • type - (Required) Opsworks application type. One of awsFlowRuby, java, rails, php, nodejs, static or other.
  • description - (Optional) A description of the app.
  • environment - (Optional) Object to define environment variables. Object is described below.
  • enableSsl - (Optional) Whether to enable SSL for the app. This must be set in order to let sslConfigurationPrivateKey, sslConfigurationCertificate and sslConfigurationChain take effect.
  • sslConfiguration - (Optional) The SSL configuration of the app. Object is described below.
  • appSource - (Optional) SCM configuration of the app as described below.
  • dataSourceArn - (Optional) The data source's ARN.
  • dataSourceType - (Optional) The data source's type one of autoSelectOpsworksMysqlInstance, opsworksMysqlInstance, or rdsDbInstance.
  • dataSourceDatabaseName - (Optional) The database name.
  • domains - (Optional) A list of virtual host alias.
  • documentRoot - (Optional) Subfolder for the document root for application of type rails.
  • autoBundleOnDeploy - (Optional) Run bundle install when deploying for application of type rails.
  • railsEnv - (Required if type = rails) The name of the Rails environment for application of type rails.
  • awsFlowRubySettings - (Optional) Specify activity and workflow workers for your app using the aws-flow gem.

An appSource block supports the following arguments (can only be defined once per resource):

  • type - (Required) The type of source to use. For example, "archive".
  • url - (Required) The URL where the app resource can be found.
  • username - (Optional) Username to use when authenticating to the source.
  • password - (Optional) Password to use when authenticating to the source. Terraform cannot perform drift detection of this configuration.
  • sshKey - (Optional) SSH key to use when authenticating to the source. Terraform cannot perform drift detection of this configuration.
  • revision - (Optional) For sources that are version-aware, the revision to use.

An environment block supports the following arguments:

  • key - (Required) Variable name.
  • value - (Required) Variable value.
  • secure - (Optional) Set visibility of the variable value to true or false.

A sslConfiguration block supports the following arguments (can only be defined once per resource):

  • privateKey - (Required) The private key; the contents of the certificate's domain.key file.
  • certificate - (Required) The contents of the certificate's domain.crt file.
  • chain - (Optional) Can be used to specify an intermediate certificate authority key or client authentication.

Attributes Reference

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

  • id - The id of the application.

Import

Opsworks Application can be imported using the id, e.g.,

$ terraform import aws_opsworks_application.test <id>