generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1822 from acwwat/d-awscc_lightsail-add_examples
docs: Add examples for awscc_lightsail_*
- Loading branch information
Showing
43 changed files
with
1,476 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,98 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "awscc_lightsail_alarm Resource - terraform-provider-awscc" | ||
subcategory: "" | ||
description: |- | ||
Resource Type definition for AWS::Lightsail::Alarm | ||
--- | ||
|
||
# awscc_lightsail_alarm (Resource) | ||
|
||
Resource Type definition for AWS::Lightsail::Alarm | ||
|
||
|
||
|
||
--- | ||
page_title: "awscc_lightsail_alarm Resource - terraform-provider-awscc" | ||
subcategory: "" | ||
description: |- | ||
Resource Type definition for AWS::Lightsail::Alarm | ||
--- | ||
|
||
# awscc_lightsail_alarm (Resource) | ||
|
||
Resource Type definition for AWS::Lightsail::Alarm | ||
|
||
## Example Usage | ||
|
||
### Alarm for Instance CPU Utilization | ||
|
||
```terraform | ||
resource "awscc_lightsail_instance" "example" { | ||
blueprint_id = "amazon_linux_2023" | ||
bundle_id = "nano_3_0" | ||
instance_name = "example-instance" | ||
} | ||
resource "awscc_lightsail_alarm" "example" { | ||
alarm_name = "example-alarm" | ||
comparison_operator = "GreaterThanThreshold" | ||
evaluation_periods = 1 | ||
metric_name = "CPUUtilization" | ||
monitored_resource_name = awscc_lightsail_instance.example.instance_name | ||
threshold = 90 | ||
} | ||
``` | ||
|
||
### Alarm for Load Balancer Unhealthy Host Count | ||
|
||
```terraform | ||
resource "awscc_lightsail_instance" "example" { | ||
blueprint_id = "nginx" | ||
bundle_id = "nano_3_0" | ||
instance_name = "example-instance" | ||
} | ||
resource "awscc_lightsail_load_balancer" "example" { | ||
instance_port = 80 | ||
load_balancer_name = "example-lb" | ||
attached_instances = [awscc_lightsail_instance.example.instance_name] | ||
} | ||
# Since there is no resource for contact method, we need to create it using null_resource and the AWS CLI instead | ||
resource "null_resource" "example_contact_method" { | ||
provisioner "local-exec" { | ||
command = "aws lightsail create-contact-method --protocol Email --contact-endpoint [email protected]" | ||
} | ||
provisioner "local-exec" { | ||
when = destroy | ||
command = "aws lightsail delete-contact-method --protocol Email" | ||
} | ||
} | ||
resource "awscc_lightsail_alarm" "example" { | ||
alarm_name = "example-alarm" | ||
comparison_operator = "GreaterThanOrEqualToThreshold" | ||
evaluation_periods = 1 | ||
metric_name = "UnhealthyHostCount" | ||
monitored_resource_name = awscc_lightsail_load_balancer.example.load_balancer_name | ||
threshold = 1 | ||
contact_protocols = ["Email"] | ||
notification_enabled = true | ||
notification_triggers = ["ALARM"] | ||
treat_missing_data = "ignore" | ||
depends_on = [null_resource.example_contact_method] | ||
} | ||
``` | ||
|
||
### Alarm for Relational Database Free Storage Space | ||
|
||
```terraform | ||
resource "awscc_lightsail_database" "example" { | ||
master_database_name = "example" | ||
master_username = "admin" | ||
relational_database_blueprint_id = "mysql_8_0" | ||
relational_database_bundle_id = "micro_2_0" | ||
relational_database_name = "example-db" | ||
} | ||
resource "awscc_lightsail_alarm" "example" { | ||
alarm_name = "example-alarm" | ||
comparison_operator = "LessThanThreshold" | ||
evaluation_periods = 1 | ||
metric_name = "FreeStorageSpace" | ||
monitored_resource_name = awscc_lightsail_database.example.relational_database_name | ||
threshold = 10737418240 | ||
notification_triggers = ["ALARM"] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
|
@@ -36,12 +117,12 @@ Resource Type definition for AWS::Lightsail::Alarm | |
|
||
- `alarm_arn` (String) | ||
- `id` (String) Uniquely identifies the resource. | ||
- `state` (String) The current state of the alarm. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
- `state` (String) The current state of the alarm. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
$ terraform import awscc_lightsail_alarm.example <resource ID> | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.