IaC Reconciliation
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.
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
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 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.
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"
}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
}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_snapshotis not supported and must be explicitly set tofalsewhen 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 deactivation is complete before proceeding to the next step.
Run
terraform applywithdatafyawsprovider for all relevant resources. This will update the Terraform state.Remove
datafyawsfrom relevant resources. You can now continue to use Terraform as desired.
Last updated
Was this helpful?
