From 35c54b907aae34bc4cef678634bd9a13133106cd Mon Sep 17 00:00:00 2001 From: LearningNewbie <35469293+LearningNewbie@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:37:55 -0500 Subject: [PATCH 1/8] Create resiliencehub_app.tf --- .../resiliencehub_app.tf | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf diff --git a/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf b/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf new file mode 100644 index 0000000000..a5ba2ca2e5 --- /dev/null +++ b/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf @@ -0,0 +1,34 @@ +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::resiliency-policy/" + app_template_body = < Date: Wed, 13 Nov 2024 16:43:01 -0500 Subject: [PATCH 2/8] Create resiliencehub_app.md.tmpl --- templates/resources/resiliencehub_app.md.tmpl | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 templates/resources/resiliencehub_app.md.tmpl diff --git a/templates/resources/resiliencehub_app.md.tmpl b/templates/resources/resiliencehub_app.md.tmpl new file mode 100644 index 0000000000..c3fb1cb67d --- /dev/null +++ b/templates/resources/resiliencehub_app.md.tmpl @@ -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 }} From 56e73ca2100341f0619e995f4f0862b655f5f20d Mon Sep 17 00:00:00 2001 From: LearningNewbie <35469293+LearningNewbie@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:44:25 -0500 Subject: [PATCH 3/8] Update resiliencehub_app.md --- docs/resources/resiliencehub_app.md | 38 ++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/resources/resiliencehub_app.md b/docs/resources/resiliencehub_app.md index a0f181e414..bf22d1d2a0 100644 --- a/docs/resources/resiliencehub_app.md +++ b/docs/resources/resiliencehub_app.md @@ -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::resiliency-policy/" + app_template_body = < ## Schema From e06d5d1a0eb31ce02a282c8f3639ab75a7c53cc5 Mon Sep 17 00:00:00 2001 From: LearningNewbie <35469293+LearningNewbie@users.noreply.github.com> Date: Mon, 18 Nov 2024 11:03:45 -0500 Subject: [PATCH 4/8] Update resiliencehub_app.tf --- .../resiliencehub_app.tf | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf b/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf index a5ba2ca2e5..f70e8c5e12 100644 --- a/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf +++ b/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf @@ -1,34 +1,43 @@ -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::resiliency-policy/" - app_template_body = < Date: Mon, 18 Nov 2024 11:33:01 -0500 Subject: [PATCH 5/8] Create resiliency_policy.tf --- .../resiliency_policy.tf | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf diff --git a/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf b/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf new file mode 100644 index 0000000000..7babc20fc5 --- /dev/null +++ b/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf @@ -0,0 +1,34 @@ +resource "awscc_resiliencehub_resiliency_policy" "example" { + policy_name = "example_policy" + tier = "MissionCritical" + policy = { + software = { + rpo_in_secs = 3600 + rto_in_secs = 3600 + } + hardware = { + rpo_in_secs = 3600 + rto_in_secs = 3600 + } + region = { + rpo_in_secs = 1200 + rto_in_secs = 1200 + } + az = { + rpo_in_secs = 1200 + rto_in_secs = 1200 + } + } + policy_description = "This is an example policy" + data_location_constraint = "us-west-2" + tags = [{ + key = "Modified By" + value = "AWSCC" + }] +} + + + + + + From 21c5931643fd36616d3477b5e51ad312603c5090 Mon Sep 17 00:00:00 2001 From: LearningNewbie <35469293+LearningNewbie@users.noreply.github.com> Date: Mon, 18 Nov 2024 11:34:43 -0500 Subject: [PATCH 6/8] Update resiliency_policy.tf --- .../resiliency_policy.tf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf b/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf index 7babc20fc5..5865febe8b 100644 --- a/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf +++ b/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf @@ -3,20 +3,20 @@ resource "awscc_resiliencehub_resiliency_policy" "example" { tier = "MissionCritical" policy = { software = { - rpo_in_secs = 3600 + rpo_in_secs = 900 rto_in_secs = 3600 } hardware = { - rpo_in_secs = 3600 - rto_in_secs = 3600 + rpo_in_secs = 300 + rto_in_secs = 300 } region = { - rpo_in_secs = 1200 - rto_in_secs = 1200 + rpo_in_secs = 300 + rto_in_secs = 300 } az = { - rpo_in_secs = 1200 - rto_in_secs = 1200 + rpo_in_secs = 300 + rto_in_secs = 300 } } policy_description = "This is an example policy" From 48b247aae6b55614e4357ede97b7095a1a2da8be Mon Sep 17 00:00:00 2001 From: LearningNewbie <35469293+LearningNewbie@users.noreply.github.com> Date: Mon, 18 Nov 2024 11:43:33 -0500 Subject: [PATCH 7/8] Delete examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf --- .../resiliency_policy.tf | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf diff --git a/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf b/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf deleted file mode 100644 index 5865febe8b..0000000000 --- a/examples/resources/awscc_resiliencehub_resiliency_policy/resiliency_policy.tf +++ /dev/null @@ -1,34 +0,0 @@ -resource "awscc_resiliencehub_resiliency_policy" "example" { - policy_name = "example_policy" - tier = "MissionCritical" - policy = { - software = { - rpo_in_secs = 900 - rto_in_secs = 3600 - } - hardware = { - rpo_in_secs = 300 - rto_in_secs = 300 - } - region = { - rpo_in_secs = 300 - rto_in_secs = 300 - } - az = { - rpo_in_secs = 300 - rto_in_secs = 300 - } - } - policy_description = "This is an example policy" - data_location_constraint = "us-west-2" - tags = [{ - key = "Modified By" - value = "AWSCC" - }] -} - - - - - - From 3895249e0213cfb6423afbb6d519c43080cb522d Mon Sep 17 00:00:00 2001 From: LearningNewbie <35469293+LearningNewbie@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:54:16 -0500 Subject: [PATCH 8/8] Update resiliencehub_app.tf --- .../resiliencehub_app.tf | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf b/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf index f70e8c5e12..718401d9fc 100644 --- a/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf +++ b/examples/resources/awscc_resiliencehub_app/resiliencehub_app.tf @@ -1,11 +1,11 @@ -resource "awscc_resiliencehub_app" "example" { +resource "awscc_resiliencehub_app" "main" { name = "test-app" description = "This is a test app." app_template_body = jsonencode({ format_version = 2 resources = [{ - name = "" - type = "" + name = "test-app" + type = "AWS::EC2::Instance" parameters = { tags = { env = "dev" @@ -13,25 +13,28 @@ resource "awscc_resiliencehub_app" "example" { } }] }) - resiliency_policy_arn = awscc_resiliencehub_resiliency_policy.example.arn + 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 = "" - aws_account_id = "" + aws_region = "us-west-2" + aws_account_id = "112223333444" } mapping_type = "Terraform" - resource_name = "" - resource_type = "" + resource_name = "test-app" + resource_type = "AWS::EC2::Instance" logical_resource = { - logical_resource_name = "" - resource_mapping_name = "" - resource_mapping_arn = awscc_resiliencehub_app.example.arn + 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" - event_subscriptions = [] permission_model = { type = "RoleBased" invoker_role_name = "resilience-hub-test-app-role"