Skip to content

Resource: awsLightsailLbHttpsRedirectionPolicy

Configures Https Redirection for a Lightsail Load Balancer. A valid Certificate must be attached to the load balancer in order to enable https redirection.

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 awsLightsailLbTest = new aws.lightsailLb.LightsailLb(this, "test", {
  healthCheckPath: "/",
  instancePort: "80",
  name: "test-load-balancer",
  tags: {
    foo: "bar",
  },
});
const awsLightsailLbCertificateTest =
  new aws.lightsailLbCertificate.LightsailLbCertificate(this, "test_1", {
    domainName: "test.com",
    lbName: awsLightsailLbTest.id,
    name: "test-load-balancer-certificate",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsLightsailLbCertificateTest.overrideLogicalId("test");
const awsLightsailLbCertificateAttachmentTest =
  new aws.lightsailLbCertificateAttachment.LightsailLbCertificateAttachment(
    this,
    "test_2",
    {
      certificateName: awsLightsailLbCertificateTest.name,
      lbName: awsLightsailLbTest.name,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsLightsailLbCertificateAttachmentTest.overrideLogicalId("test");
const awsLightsailLbHttpsRedirectionPolicyTest =
  new aws.lightsailLbHttpsRedirectionPolicy.LightsailLbHttpsRedirectionPolicy(
    this,
    "test_3",
    {
      enabled: true,
      lbName: awsLightsailLbTest.name,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsLightsailLbHttpsRedirectionPolicyTest.overrideLogicalId("test");

Argument Reference

The following arguments are supported:

  • lbName - (Required) The name of the load balancer to which you want to enable http to https redirection.
  • enabled - (Required) - The Https Redirection state of the load balancer. true to activate http to https redirection or false to deactivate http to https redirection.

Attributes Reference

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

  • id - The name used for this load balancer (matches lbName).

Import

awsLightsailLbHttpsRedirectionPolicy can be imported by using the lbName attribute, e.g.,

$ terraform import aws_lightsail_lb_https_redirection_policy.test example-load-balancer