gear-codeIaC Reconciliation

Datafy and Infrastructure as Code (IaC)

When using Datafy AutoScaler, your original EBS volumes are replaced with Datafy-managed volumes. While the OS and applications remain unaffected thanks to Datafy's virtualization layer, Infrastructure as Code (IaC) tools like Terraform may encounter issues.

IaC tools anticipate specific EBS volumes as declared in code, leading to a mismatch between the expected original volume and the actual autoscaling volumes. Potential problems include unnecessary volume recreations, drift detection errors, failure during instance operations, and increased manual reconciliation efforts.

To resolve this, Datafy provides reconciliation plugins for common IaC tools. These plugins ensure that your IaC tool understands and accommodates the state changes introduced by Datafy.

circle-info

Don’t see your tool listed? Let us know—we’re actively expanding support.

Terraform

Datafy provides a custom Terraform provider called datafyawsarrow-up-right. It integrates seamlessly into your Terraform workflows and ensures that Terraform’s state remains in sync with the actual volumes managed by AutoScaler.

circle-exclamation

Getting Started

1

Install Provider

Add the provider to your required_providers block:

terraform {
  required_providers {
    datafyaws = {
      source  = "datafy-io/datafyaws"
      version = "~> 1.0"
      // ADDITIONAL_CONFIGS = "copy values from matching aws provider"
    }
  }
}

A datafyaws provider needs to be defined for every AWS providerarrow-up-right already defined in your Terraform files.

Make sure to use a version of datafyaws that supports the version of the AWS provider you use. See the documentation of the latest versionarrow-up-right in the Terraform registry.

2

Configure Provider

The datafyaws provider should be configured with the same parameters as the existing AWS providers. The datafy_token can be set via environment variable or directly in the config:

provider "datafyaws" {
  datafy_token  = <TOKEN>
  // ADDITIONAL_CONFIGS = "copy values from matching aws provider"
}
3

Add Provider to Resources

The following Terraform resource types are supported:

Add provider = datafyaws to each supported resource that is managed by AutoScaler, or associated with a volume managed by AutoScaler:

resource "aws_ebs_volume" "example" {
  provider = datafyaws

  availability_zone = "us-east-1a"
  size              = 40
}
circle-info

datafyaws does not support nested volume declarations. Volumes must be defined separately from the instances to which they are attached.

Limitations

  • The provider should only be used with the supported resource types listed above. Other resource types are currently not supported for autoscaling volumes.

  • final_snapshot is not supported and must be explicitly set to false when destroying volumes.

Removing Datafy Provider

As long as your AWS account is associated with an active Datafy account, there is no need to remove the datafyaws provider - it will work in the same manner as the AWS Terraform provider for all non-autoscaling volumes.

If you need to remove the provider, perform the following steps:

  1. Turn off autoscaling for all relevant volumes. Make sure the migration is complete before proceeding to the next step.

  2. Run terraform apply with datafyaws provider for all relevant resources. This will update the Terraform state.

  3. Remove datafyaws from relevant resources. You can now continue to use Terraform as desired.

Last updated

Was this helpful?