@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
406 lines (405 loc) • 14.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Manages a Lightsail content delivery network (CDN) distribution. Use this resource to cache content at edge locations and reduce latency for users accessing your content.
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.Bucket("example", {
* name: "example-bucket",
* bundleId: "small_1_0",
* });
* const exampleDistribution = new aws.lightsail.Distribution("example", {
* name: "example-distribution",
* bundleId: "small_1_0",
* origin: {
* name: example.name,
* regionName: example.region,
* },
* defaultCacheBehavior: {
* behavior: "cache",
* },
* cacheBehaviorSettings: {
* allowedHttpMethods: "GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE",
* cachedHttpMethods: "GET,HEAD",
* defaultTtl: 86400,
* maximumTtl: 31536000,
* minimumTtl: 0,
* forwardedCookies: {
* option: "none",
* },
* forwardedHeaders: {
* option: "default",
* },
* forwardedQueryStrings: {
* option: false,
* },
* },
* });
* ```
*
* ### Instance Origin
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const available = aws.getAvailabilityZones({
* state: "available",
* filters: [{
* name: "opt-in-status",
* values: ["opt-in-not-required"],
* }],
* });
* const exampleStaticIp = new aws.lightsail.StaticIp("example", {name: "example-static-ip"});
* const exampleInstance = new aws.lightsail.Instance("example", {
* name: "example-instance",
* availabilityZone: available.then(available => available.names?.[0]),
* blueprintId: "amazon_linux_2",
* bundleId: "micro_1_0",
* });
* const example = new aws.lightsail.StaticIpAttachment("example", {
* staticIpName: exampleStaticIp.name,
* instanceName: exampleInstance.name,
* });
* const exampleDistribution = new aws.lightsail.Distribution("example", {
* name: "example-distribution",
* bundleId: "small_1_0",
* origin: {
* name: exampleInstance.name,
* regionName: available.then(available => available.id),
* },
* defaultCacheBehavior: {
* behavior: "cache",
* },
* }, {
* dependsOn: [example],
* });
* ```
*
* ### Load Balancer Origin
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const available = aws.getAvailabilityZones({
* state: "available",
* filters: [{
* name: "opt-in-status",
* values: ["opt-in-not-required"],
* }],
* });
* const example = new aws.lightsail.Lb("example", {
* name: "example-load-balancer",
* healthCheckPath: "/",
* instancePort: 80,
* tags: {
* foo: "bar",
* },
* });
* const exampleInstance = new aws.lightsail.Instance("example", {
* name: "example-instance",
* availabilityZone: available.then(available => available.names?.[0]),
* blueprintId: "amazon_linux_2",
* bundleId: "nano_3_0",
* });
* const exampleLbAttachment = new aws.lightsail.LbAttachment("example", {
* lbName: example.name,
* instanceName: exampleInstance.name,
* });
* const exampleDistribution = new aws.lightsail.Distribution("example", {
* name: "example-distribution",
* bundleId: "small_1_0",
* origin: {
* name: example.name,
* regionName: available.then(available => available.id),
* },
* defaultCacheBehavior: {
* behavior: "cache",
* },
* }, {
* dependsOn: [exampleLbAttachment],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Lightsail Distribution using the `name`. For example:
*
* ```sh
* $ pulumi import aws:lightsail/distribution:Distribution example example-distribution
* ```
*/
export declare class Distribution extends pulumi.CustomResource {
/**
* Get an existing Distribution resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DistributionState, opts?: pulumi.CustomResourceOptions): Distribution;
/**
* Returns true if the given object is an instance of Distribution. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Distribution;
/**
* Alternate domain names of the distribution.
*/
readonly alternativeDomainNames: pulumi.Output<string[]>;
/**
* ARN of the distribution.
*/
readonly arn: pulumi.Output<string>;
/**
* Bundle ID to use for the distribution.
*/
readonly bundleId: pulumi.Output<string>;
/**
* Cache behavior settings of the distribution. See below.
*/
readonly cacheBehaviorSettings: pulumi.Output<outputs.lightsail.DistributionCacheBehaviorSettings | undefined>;
/**
* Per-path cache behavior of the distribution. See below.
*/
readonly cacheBehaviors: pulumi.Output<outputs.lightsail.DistributionCacheBehavior[] | undefined>;
/**
* Name of the SSL/TLS certificate attached to the distribution.
*/
readonly certificateName: pulumi.Output<string | undefined>;
/**
* Timestamp when the distribution was created.
*/
readonly createdAt: pulumi.Output<string>;
/**
* Default cache behavior of the distribution. See below.
*/
readonly defaultCacheBehavior: pulumi.Output<outputs.lightsail.DistributionDefaultCacheBehavior>;
/**
* Domain name of the distribution.
*/
readonly domainName: pulumi.Output<string>;
/**
* IP address type of the distribution. Valid values: `dualstack`, `ipv4`. Default: `dualstack`.
*/
readonly ipAddressType: pulumi.Output<string | undefined>;
/**
* Whether the distribution is enabled. Default: `true`.
*/
readonly isEnabled: pulumi.Output<boolean | undefined>;
/**
* Location of the distribution, such as the AWS Region and Availability Zone. See below.
*/
readonly locations: pulumi.Output<outputs.lightsail.DistributionLocation[]>;
/**
* Name of the distribution.
*/
readonly name: pulumi.Output<string>;
/**
* Origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer. See below.
*
* The following arguments are optional:
*/
readonly origin: pulumi.Output<outputs.lightsail.DistributionOrigin>;
/**
* Public DNS of the origin.
* * `origin[0].resource_type` - Resource type of the origin resource (e.g., Instance).
*/
readonly originPublicDns: pulumi.Output<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
readonly region: pulumi.Output<string>;
/**
* Lightsail resource type (e.g., Distribution).
*/
readonly resourceType: pulumi.Output<string>;
/**
* Status of the distribution.
*/
readonly status: pulumi.Output<string>;
/**
* Support code. Include this code in your email to support when you have questions about your Lightsail distribution. This code enables our support team to look up your Lightsail information more easily.
*/
readonly supportCode: pulumi.Output<string>;
/**
* Map of tags for the Lightsail Distribution. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
readonly tags: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
*/
readonly tagsAll: pulumi.Output<{
[key: string]: string;
}>;
/**
* Create a Distribution resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: DistributionArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Distribution resources.
*/
export interface DistributionState {
/**
* Alternate domain names of the distribution.
*/
alternativeDomainNames?: pulumi.Input<pulumi.Input<string>[]>;
/**
* ARN of the distribution.
*/
arn?: pulumi.Input<string>;
/**
* Bundle ID to use for the distribution.
*/
bundleId?: pulumi.Input<string>;
/**
* Cache behavior settings of the distribution. See below.
*/
cacheBehaviorSettings?: pulumi.Input<inputs.lightsail.DistributionCacheBehaviorSettings>;
/**
* Per-path cache behavior of the distribution. See below.
*/
cacheBehaviors?: pulumi.Input<pulumi.Input<inputs.lightsail.DistributionCacheBehavior>[]>;
/**
* Name of the SSL/TLS certificate attached to the distribution.
*/
certificateName?: pulumi.Input<string>;
/**
* Timestamp when the distribution was created.
*/
createdAt?: pulumi.Input<string>;
/**
* Default cache behavior of the distribution. See below.
*/
defaultCacheBehavior?: pulumi.Input<inputs.lightsail.DistributionDefaultCacheBehavior>;
/**
* Domain name of the distribution.
*/
domainName?: pulumi.Input<string>;
/**
* IP address type of the distribution. Valid values: `dualstack`, `ipv4`. Default: `dualstack`.
*/
ipAddressType?: pulumi.Input<string>;
/**
* Whether the distribution is enabled. Default: `true`.
*/
isEnabled?: pulumi.Input<boolean>;
/**
* Location of the distribution, such as the AWS Region and Availability Zone. See below.
*/
locations?: pulumi.Input<pulumi.Input<inputs.lightsail.DistributionLocation>[]>;
/**
* Name of the distribution.
*/
name?: pulumi.Input<string>;
/**
* Origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer. See below.
*
* The following arguments are optional:
*/
origin?: pulumi.Input<inputs.lightsail.DistributionOrigin>;
/**
* Public DNS of the origin.
* * `origin[0].resource_type` - Resource type of the origin resource (e.g., Instance).
*/
originPublicDns?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Lightsail resource type (e.g., Distribution).
*/
resourceType?: pulumi.Input<string>;
/**
* Status of the distribution.
*/
status?: pulumi.Input<string>;
/**
* Support code. Include this code in your email to support when you have questions about your Lightsail distribution. This code enables our support team to look up your Lightsail information more easily.
*/
supportCode?: pulumi.Input<string>;
/**
* Map of tags for the Lightsail Distribution. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
*/
tagsAll?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
}
/**
* The set of arguments for constructing a Distribution resource.
*/
export interface DistributionArgs {
/**
* Bundle ID to use for the distribution.
*/
bundleId: pulumi.Input<string>;
/**
* Cache behavior settings of the distribution. See below.
*/
cacheBehaviorSettings?: pulumi.Input<inputs.lightsail.DistributionCacheBehaviorSettings>;
/**
* Per-path cache behavior of the distribution. See below.
*/
cacheBehaviors?: pulumi.Input<pulumi.Input<inputs.lightsail.DistributionCacheBehavior>[]>;
/**
* Name of the SSL/TLS certificate attached to the distribution.
*/
certificateName?: pulumi.Input<string>;
/**
* Default cache behavior of the distribution. See below.
*/
defaultCacheBehavior: pulumi.Input<inputs.lightsail.DistributionDefaultCacheBehavior>;
/**
* IP address type of the distribution. Valid values: `dualstack`, `ipv4`. Default: `dualstack`.
*/
ipAddressType?: pulumi.Input<string>;
/**
* Whether the distribution is enabled. Default: `true`.
*/
isEnabled?: pulumi.Input<boolean>;
/**
* Name of the distribution.
*/
name?: pulumi.Input<string>;
/**
* Origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer. See below.
*
* The following arguments are optional:
*/
origin: pulumi.Input<inputs.lightsail.DistributionOrigin>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Map of tags for the Lightsail Distribution. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
}