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.
Don’t see your tool listed? Let us know—we’re actively expanding support.
Terraform
Datafy provides a custom Terraform provider called datafyaws. It integrates seamlessly into your Terraform workflows and ensures that Terraform’s state remains in sync with the actual volumes managed by AutoScaler.
The datafyaws provider reconciles the state of volumes that were originally created using Terraform. It cannot reconcile volumes not created or managed by Terraform.
Getting Started
1
Install Provider
Add the provider to your required_providers block:
A datafyaws provider needs to be defined for every AWS provider 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 version 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:
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:
Turn off autoscaling for all relevant volumes. Make sure the migration is complete before proceeding to the next step.
Run terraform apply with datafyaws provider for all relevant resources. This will update the Terraform state.
Remove datafyaws from relevant resources. You can now continue to use Terraform as desired.