Skip to content

Latest commit

 

History

History
165 lines (143 loc) · 5.8 KB

cloud_formation_app_blueprint.md

File metadata and controls

165 lines (143 loc) · 5.8 KB
page_title subcategory description
morpheus_cloud_formation_app_blueprint Resource - terraform-provider-morpheus
Provides a Morpheus cloud formation app blueprint resource

morpheus_cloud_formation_app_blueprint

Provides a Morpheus cloud formation app blueprint resource

Example Usage

Creating the Cloud Formation app blueprint with local content in json format:

resource "morpheus_cloud_formation_app_blueprint" "tf_example_cloud_formation_app_blueprint_git" {
  name                   = "example_cloud_formation_app_blueprint_json"
  description            = "Example cloud formation app blueprint"
  category               = "cloudformation"
  install_agent          = true
  cloud_init_enabled     = true
  capability_iam         = true
  capability_named_iam   = true
  capability_auto_expand = true
  source_type            = "json"
  blueprint_content      = <<TFEOF
{
  "AWSTemplateFormatVersion" : "2010-09-09",

  "Description" : "AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete: Sample template showing how to create a publicly accessible S3 bucket configured for website access with a deletion policy of retain on delete. **WARNING** This template creates an S3 bucket that will NOT be deleted when the stack is deleted. You will be billed for the AWS resources used if you create a stack from this template.",

  "Resources" : {
    "S3Bucket" : {
      "Type" : "AWS::S3::Bucket",
      "Properties" : {
        "AccessControl" : "PublicRead",
        "WebsiteConfiguration" : {
          "IndexDocument" : "index.html",
          "ErrorDocument" : "error.html"
         }
      },
      "DeletionPolicy" : "Retain"
    }
  },

  "Outputs" : {
    "WebsiteURL" : {
      "Value" : { "Fn::GetAtt" : [ "S3Bucket", "WebsiteURL" ] },
      "Description" : "URL for website hosted on S3"
    },
    "S3BucketSecureURL" : {
      "Value" : { "Fn::Join" : [ "", [ "https://", { "Fn::GetAtt" : [ "S3Bucket", "DomainName" ] } ] ] },
      "Description" : "Name of S3 bucket to hold website content"
    }
  }
}
TFEOF
}

Creating the Cloud Formation app blueprint with local content in yaml format:

resource "morpheus_cloud_formation_app_blueprint" "tf_example_cloud_formation_app_blueprint_git" {
  name                   = "example_cloud_formation_app_blueprint_yaml"
  description            = "Example cloud formation app blueprint"
  category               = "cloudformation"
  install_agent          = true
  cloud_init_enabled     = true
  capability_iam         = true
  capability_named_iam   = true
  capability_auto_expand = true
  source_type            = "yaml"
  blueprint_content      = <<TFEOF
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete:
  Sample template showing how to create a publicly accessible S3 bucket configured
  for website access with a deletion policy of retain on delete. **WARNING** This
  template creates an S3 bucket that will NOT be deleted when the stack is deleted.
  You will be billed for the AWS resources used if you create a stack from this template.'
Resources:
  S3Bucket:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: PublicRead
      WebsiteConfiguration:
        IndexDocument: index.html
        ErrorDocument: error.html
    DeletionPolicy: Retain
Outputs:
  WebsiteURL:
    Value:
      Fn::GetAtt:
      - S3Bucket
      - WebsiteURL
    Description: URL for website hosted on S3
  S3BucketSecureURL:
    Value:
      Fn::Join:
      - ''
      - - https://
        - Fn::GetAtt:
          - S3Bucket
          - DomainName
    Description: Name of S3 bucket to hold website content
TFEOF
}

Creating the Cloud Formation app blueprint with the blueprint fetched via git:

resource "morpheus_cloud_formation_app_blueprint" "tf_example_cloud_formation_app_blueprint_git" {
  name                   = "example_cloud_formation_app_blueprint_git"
  description            = "Example cloud formation app blueprint"
  category               = "cloudformation"
  install_agent          = true
  cloud_init_enabled     = true
  capability_iam         = true
  capability_named_iam   = true
  capability_auto_expand = true
  source_type            = "repository"
  working_path           = "./test"
  integration_id         = 3
  repository_id          = 1
  version_ref            = "main"
}

Schema

Required

  • name (String) The name of the cloud formation app blueprint
  • source_type (String) The source of the cloud formation app blueprint (yaml, json, repository)

Optional

  • blueprint_content (String) The content of the cloud formation app blueprint. Used when the yaml or json source types are specified
  • capability_auto_expand (Boolean) Whether the auto expand capability is added to the cloud formation
  • capability_iam (Boolean) Whether the iam capability is added to the cloud formation
  • capability_named_iam (Boolean) Whether the named iam capability is added to the cloud formation
  • category (String) The category of the cloud formation app blueprint
  • cloud_init_enabled (Boolean) Whether cloud init is enabled
  • description (String) The description of the cloud formation app blueprint
  • install_agent (Boolean) Whether to install the Morpheus agent
  • integration_id (Number) The ID of the git integration
  • repository_id (Number) The ID of the git repository
  • version_ref (String) The git reference of the repository to pull (main, master, etc.)
  • working_path (String) The path of the cloud formation chart in the git repository

Read-Only

  • id (String) The ID of the cloud formation app blueprint

Import

Import is supported using the following syntax:

terraform import morpheus_cloud_formation_app_blueprint.tf_example_cloud_formation_app_blueprint 1