This directory contains terraform modules that you may use to automate the deployment of the Elastio Connector stacks in your AWS accounts.
First of all, you'll need a secret PAT token to authenticate your Elastio installation with the Elastio Portal. You can generate one by following the steps below.
- Open the Elastio Portal in your web browser.
- Go to the
Settingspage. - Open the
API accesstab. - Click on
Add New Access Token. - Enter the name for the token, for example
Elastio deployment. - Select the scope
Sources: Writefor the token. - Click on
Generate Token. - Copy the generated token.
- Optional step. Save the token in a secure place like 1Password or any other secret management system of your choice. This way you won't lose it.
There is are several terraform modules that you can use. We'll review all of them below.
Configure the Elastio terraform module registry before adding any Elastio terraform modules to your project.
This module provides the easiest way to get started. It resides as the top-level module in this directory. It deploys all the necessary resources for Elastio to operate in a single module for the entire AWS account and covers many regions.
Add this terraform module to your terraform project and specify the necessary input variables. Here you'll need to pass the PAT token you generated earlier.
Important
Make sure curl of version at least 7.76.0 is installed on the machine that runs the terraform deployment (terraform apply). The provided terraform module uses a local-exec provisioner that uses curl to do a REST API call to Elastio Portal.
Here is the basic example usage of the module that deploys Elastio Connectors in several regions allowing you to scan your assets in these regions.
module "elastio_connector" {
source = "terraform.cloudsmith.io/public/elastio-connector/aws"
version = "0.33.1"
elastio_tenant = var.elastio_tenant
elastio_pat = var.elastio_pat
elastio_cloud_connectors = [
{
region = "us-east-1"
},
{
region = "us-east-2",
}
]
}You can find the full version of this example in examples/basic.
This module deploys the following three modules internally, that you can deploy individually if a finer grained control over the deployment is required. You may use them, for example, if you need to deploy regional stacks in separate terraform projects instead of using a single one that deploys all regions.
Creates an AWS CloudFormation stack named elastio-account-level-stack, which is deployed once per AWS account and contains the required IAM resources (roles, policies, etc.) for Elastio Connector to operate in the same account.
See modules/account directory for details.
Deploys the Elastio Cloud Connector stack via a REST API call to the Elastio Portal. The final stack contains Lambda functions, DynamoDB databases, S3 buckets, AWS Batch compute environments and other non-IAM resources.
See modules/region directory for details.
Optional. AWS CloudFormation stack named elastio-nat-provision-lambda which deploys NAT gateways in the private subnets where Elastio scan job workers run. This is necessary only if you deploy Elastio into private subnets that don't have outbound Internet access already. Alternatively, you can deploy your own NAT gateway if you want to.
See modules/nat-provision directory for details.
| Name | Version |
|---|---|
| terraform | ~> 1.0 |
| aws | ~> 5.0 |
| http | ~> 3.0 |
No providers.
| Name | Source | Version |
|---|---|---|
| account | ./modules/account | n/a |
| nat_provision | ./modules/nat-provision | n/a |
| region | ./modules/region | n/a |
No resources.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| disable_customer_managed_iam_policies | If this is set to false (or omitted), then the stack will createadditional customer-managed IAM policies that you can attach to your IAM identities to grant them direct access to the Elastio Connector stack. This way you can use elastio CLI directly to list Elastio scan jobs or submit new scan jobs. Set this to true if you don't need these policies. |
bool |
null |
no |
| ecr_public_prefix | Repository prefix for the ECR Public registry. Used to configure a pull-through cache for elastio images that are downloaded from ECR Public. You can configure your own cache via ECR private, and then specify the repository prefix here. This field supports 'account_id' and 'region' interpolation. For example, such value can be provided: '{{account_id}}.dkr.ecr.{{region}}.amazonaws.com/ecr-public' |
string |
null |
no |
| elastio_cloud_connectors | List of regions where Cloud Connectors are to be deployed, VPC and subnet(s) to use, and other regional configurations (mostly for regulatory compliance). |
list(object({ |
n/a | yes |
| elastio_nat_provision_stack | Specifies the version of Elastio NAT provision stack to deploy (e.g. v5).This is a CloudFormation stack that automatically provisions NAT Gateways in your VPC when Elastio worker instances run to provide them with the outbound Internet access when Elastio is deployed in private subnets. If you don't need this stack (e.g. you already have NAT gateways in your VPC or you deploy into public subnets) you can omit this parameter. The default value of null means there won't be any NAT provision stack deployed.The source code of this stack can be found here: https://github.com/elastio/contrib/tree/master/elastio-nat-provision-lambda |
string |
null |
no |
| elastio_pat | Personal Access Token generated by the Elastio Portal | string |
n/a | yes |
| elastio_tenant | Name of your Elastio tenant. For example mycompany.app.elastio.com |
string |
n/a | yes |
| encrypt_with_cmk | Provision additional customer-managed KMS keys to encrypt Lambda environment variables, DynamoDB tables, S3. Note that by default data is encrypted with AWS-managed keys. Enable this option only if your compliance requirements mandate the usage of CMKs. If this option is disabled Elastio creates only 1 CMK per region where the Elastio Connector stack is deployed. If this option is enabled then Elastio creates 1 KMS key per AWS account and 2 KMS keys per every AWS region where Elastio is deployed in your AWS account. If you have elastio_nat_provision_stack enabled as well, then 1 more KMS keywill be created as part of that stack as well (for a total of 3 KMS keys per region). |
bool |
null |
no |
| global_managed_policies | List of IAM managed policies ARNs to attach to all Elastio IAM roles | set(string) |
null |
no |
| global_permission_boundary | The ARN of the IAM managed policy to use as a permission boundary for all Elastio IAM roles | string |
null |
no |
| iam_resource_names_prefix | Add a custom prefix to names of all IAM resources deployed by this stack. The sum of the length of the prefix and suffix must not exceed 14 characters. |
string |
null |
no |
| iam_resource_names_static | If enabled, the stack will use static resource names without random characters in them. This parameter is set to true by default, and it shouldn't be changed. The olderversions of Elastio stack used random names generated by CloudFormation for IAM resources, which is inconvenient to work with. New deployments that use the terraform automation should have this set to true for easier management of IAM resources. |
bool |
true |
no |
| iam_resource_names_suffix | Add a custom prefix to names of all IAM resources deployed by this stack. The sum of the length of the prefix and suffix must not exceed 14 characters. |
string |
null |
no |
| lambda_tracing | Enable AWS X-Ray tracing for Lambda functions. This increases the cost of the stack. Enable only if needed |
bool |
null |
no |
| network_configuration | Can be set to either Auto or Manual. If set to Auto, Elastio willautomatically create a VPC and subnets in the specified regions for the scan clusters to run in. If set to Manual, you must provide the VPC ID and subnet IDs in theelastio_cloud_connectors with the network config for each region. |
string |
"Manual" |
no |
| service_linked_roles | By default the CFN stack creates the service-linked IAM roles needed by the stack. Since these are global in your account, they can't be defined as regular resources in the CFN, because these roles may already exist in your account and thus the deployment would fail on a name conflict. Instead, by default, they are deployed using an AWS::CloudFormation::CustomResource which invokes an AWS Lambda function that creates the service-linked roles only if they don't exist and doesn't fail if they do. The default approach of creating the service-linked roles via the CFN requires creating a lambda function in your environment that has IAM write permission of iam:CreateServiceLinkedRole. If you can't afford creating such a lambda functionthen set this parameter to tf and this terraform module will create theservice-linked roles without the need for a lambda function. If you set this to tf, then make sure you have the AWS CLI installed andconfigured with the necessary credentials on the machine where you run terraform. |
string |
"cfn" |
no |
No outputs.