Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added example for resilience hub app #2102

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion docs/resources/resiliencehub_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,43 @@ description: |-

Resource Type Definition for AWS::ResilienceHub::App.


## Example Usage

```terraform
resource "awscc_resiliencehub_app" "main" {
name = "test-app"
resource_mappings = [{
physical_resource_id = {
identifier = "s3://terraform-state-files/test-app.tfstate"
type = "Native"
# Optional aws_region = ""
# Optional aws_account_id = ""
}
mapping_type = "Terraform"
# Optional resource_name = ""
# resource_type = ""
# logical_resource = {
# logical_resource_name = ""
# resource_mapping_name = ""
# resource_mapping_arn = awscc_resiliencehub_app.app.arn
}]
resiliency_policy_arn = "arn:aws:resiliencehub:us-west-1:<account-id>:resiliency-policy/<id>"
app_template_body = <<EOF
{ "resources": [], "appComponents": [], "excludedResources": { "logicalResourceIds": [] }, "version": 2 }
EOF
description = "This is a test app."
app_assessment_schedule = "Daily"
event_subscriptions = []
permission_model = {
type = "RoleBased"
# Optional invoker_role_name = "resilience-hub-test-app-role"
}
tags = [{
key = "Modified By"
value = "AWSCC"
}]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
46 changes: 46 additions & 0 deletions examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
resource "awscc_resiliencehub_app" "main" {
name = "test-app"
description = "This is a test app."
app_template_body = jsonencode({
format_version = 2
resources = [{
name = "test-app"
type = "AWS::EC2::Instance"
parameters = {
tags = {
env = "dev"
}
}
}]
})
resiliency_policy_arn = awscc_resiliencehub_resiliency_policy.test.arn
resource_mappings = [{
physical_resource_id = {
identifier = "s3://terraform-state-files/test-app.tfstate"
type = "Native"
aws_region = "us-west-2"
aws_account_id = "112223333444"
}
mapping_type = "Terraform"
resource_name = "test-app"
resource_type = "AWS::EC2::Instance"
logical_resource = {
logical_resource_name = "test-app"
resource_mapping_arn = awscc_resiliencehub_app.app.arn
}

}]
event_subscriptions = [{
name = "test-app"
sns_topic_arn = awscc_sns_topic.sns_example.arn
}]
app_assessment_schedule = "Daily"
permission_model = {
type = "RoleBased"
invoker_role_name = "resilience-hub-test-app-role"
}
tags = [{
key = "Modified By"
value = "AWSCC"
}]
}
26 changes: 26 additions & 0 deletions templates/resources/resiliencehub_app.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

## Example Usage

{{ tffile (printf "examples/resources/%s/resiliencehub_app.tf" .Name)}}


{{ .SchemaMarkdown | trimspace }}
{{- if .HasImport }}

## Import

Import is supported using the following syntax:

{{ codefile "shell" .ImportFile }}

{{- end }}