Managing Enterprise File Storage with OVHcloud Terraform provider
Objective
Enterprise File Storage is a storage solution that allows you to provision NFS volumes that are fully managed by OVHcloud. Terraform is an infrastructure-as-code tool that automates resource provisioning.
In this guide, you will learn how to use OVHcloud Terraform provider to manage your EFS solution volumes, snapshots and more.
Info
In this guide, a volume is also called share as in the OVHcloud API.
Learn how manage your EFS service using Terraform.
The init command will initialize your working directory which contains .tf configuration files.
It’s the first command to execute for a new configuration, or after doing a checkout of an existing configuration in a given git repository for example.
The init command will download the necessary providers and initialize the backend.
[Success]
Once the initialization is successfull you are now able to manage Enterprise File Storage resources and data sources that are availalable inside the OVHcloud Terraform provider.
Service management
Get service information
Use the ovh_storage_efs data source to fetch service details.
Create a main.tf file:
data "ovh_storage_efs" "efs" { service_name = "<service_id>" # Replace this value with EFS service ID.}
terraform apply -var-file=secrets.tfvarsdata.ovh_storage_efs.efs: Reading...data.ovh_storage_efs.efs: Read complete after 0s [id=xxx-xxx-xxx-xxx-xxx]Changes to Outputs: + service_id = "xxx-xxx-xxx-xxx-xxx" + service_product = "enterprise-file-storage-premium-1tb" + service_quota = 1000You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yesApply complete! Resources: 0 added, 0 changed, 0 destroyed.Outputs:service_id = "xxx-xxx-xxx-xxx-xxx"service_product = "enterprise-file-storage-premium-1tb"service_quota = 1000
Volumes Management
OVHcloud Terraform Provider allows the following volume management operations: creation, modification and deletion.
terraform plan -var-file=secrets.tfvars -out main.tfplanTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + createTerraform will perform the following actions: # ovh_storage_efs_share.volume will be created + resource "ovh_storage_efs_share" "volume" { + created_at = (known after apply) + description = "My share" + id = (known after apply) + mount_point_name = (known after apply) + name = "share" + protocol = "NFS" + service_name = "xxx-xxx-xxx-xxx-xxx" + size = 100 + snapshot_id = (known after apply) + status = (known after apply) }Plan: 1 to add, 0 to change, 0 to destroy.Saved the plan to: main.tfplanTo perform exactly these actions, run the following command to apply: terraform apply "main.tfplan"
Key points:
The terraform plan command will create an execution plan but won't execute it. Instead, it will determine what actions are necessary to create the configuration specified inside your configuration files. This will allow you to verifiy whether your execution plan matches exectations before making any changes to actual resources.
The optional -out parameter allows your to specifiy an output file for the plan. It will ensure that the plan you reviewed will be the same as what is applied.
Once you reviewed the execution plan, run terraform apply to make changes:
If your volume has manual snapshots that are not referenced by Terraform, they must be deleted before the volume is deleted.
terraform destroy -var-file=secrets.tfvarsovh_storage_efs_share.volume: Refreshing state... [id=29d1facf-db03-4951-a4e4-c6c8ac7b1104]Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: - destroyTerraform will perform the following actions: # ovh_storage_efs_share.volume will be destroyed - resource "ovh_storage_efs_share" "volume" { - created_at = "2025-07-01T09:53:17Z" -> null - description = "My share" -> null - id = "29d1facf-db03-4951-a4e4-c6c8ac7b1104" -> null - name = "share" -> null - protocol = "NFS" -> null - service_name = "xxx-xxx-xxx-xxx-xxx" -> null - size = 100 -> null - status = "available" -> null # (1 unchanged attribute hidden) }Plan: 0 to add, 0 to change, 1 to destroy.Do you really want to destroy all resources? Terraform will destroy all your managed infrastructure, as shown above. There is no undo. Only 'yes' will be accepted to confirm. Enter a value: yesovh_storage_efs_share.volume: Destroying... [id=29d1facf-db03-4951-a4e4-c6c8ac7b1104]ovh_storage_efs_share.volume: Destruction complete after 1sDestroy complete! Resources: 1 destroyed.
output "share_acccess_path" { value = data.ovh_storage_efs_share_access_path.access_path}output "share_access_paths" { value = data.ovh_storage_efs_share_access_paths.access_paths}
Run terraform apply to add your data source and create outputs:
terraform apply data_source.tfplanTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create <= read (data resources)Terraform will perform the following actions: # data.ovh_storage_efs_share_access_path.access_path will be read during apply # (config refers to values not yet known) <= data "ovh_storage_efs_share_access_path" "access_path" { + id = (known after apply) + path = (known after apply) + preferred = (known after apply) + service_name = "xxx-xxx-xxx-xxx-xxx" + share_id = (known after apply) } # data.ovh_storage_efs_share_access_paths.access_paths will be read during apply # (config refers to values not yet known) <= data "ovh_storage_efs_share_access_paths" "access_paths" { + access_paths = (known after apply) + service_name = "xxx-xxx-xxx-xxx-xxx" + share_id = (known after apply) } # ovh_storage_efs_share.volume will be created + resource "ovh_storage_efs_share" "volume" { + created_at = (known after apply) + description = "My share" + id = (known after apply) + mount_point_name = (known after apply) + name = "share" + protocol = "NFS" + service_name = "xxx-xxx-xxx-xxx-xxx" + size = 100 + snapshot_id = (known after apply) + status = (known after apply) }Plan: 1 to add, 0 to change, 0 to destroy.Changes to Outputs: + share_acccess_path = { + id = (known after apply) + path = (known after apply) + preferred = (known after apply) + service_name = "xxx-xxx-xxx-xxx-xxx" + share_id = (known after apply) } + share_access_paths = { + access_paths = (known after apply) + service_name = "xxx-xxx-xxx-xxx-xxx" + share_id = (known after apply) }Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yesovh_storage_efs_share.volume: Creating...ovh_storage_efs_share.volume: Still creating... [10s elapsed]ovh_storage_efs_share.volume: Creation complete after 10s [id=1d6669a7-8b86-472a-bb04-cf8be7b9af16]data.ovh_storage_efs_share_access_paths.access_paths: Reading...data.ovh_storage_efs_share_access_paths.access_paths: Read complete after 1sdata.ovh_storage_efs_share_access_path.access_path: Reading...data.ovh_storage_efs_share_access_path.access_path: Read complete after 0s [id=7cbcf0ca-50f4-4e3c-9222-406e71a10649]Apply complete! Resources: 1 added, 0 changed, 0 destroyed.Outputs:share_acccess_path = { "id" = "7cbcf0ca-50f4-4e3c-9222-406e71a10649" "path" = "10.6.0.1:/share_b038413e_c446_4788_871f_a762fb1b7697" "preferred" = true "service_name" = "xxx-xxx-xxx-xxx-xxx" "share_id" = "1d6669a7-8b86-472a-bb04-cf8be7b9af16"}share_access_paths = { "access_paths" = toset([ { "id" = "7cbcf0ca-50f4-4e3c-9222-406e71a10649" "path" = "10.6.0.1:/share_b038413e_c446_4788_871f_a762fb1b7697" "preferred" = true }, ]) "service_name" = "xxx-xxx-xxx-xxx-xxx" "share_id" = "1d6669a7-8b86-472a-bb04-cf8be7b9af16"}
Snapshots Management
OVHcloud Terraform Provider allows the following snapshot management operations: creation, modification and deletion.
terraform plan -var-file=secrets.tfvars -out main.tfplanTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + createTerraform will perform the following actions: # ovh_storage_efs_share.volume will be created + resource "ovh_storage_efs_share" "volume" { + created_at = (known after apply) + description = "My share" + id = (known after apply) + mount_point_name = (known after apply) + name = "share" + protocol = "NFS" + service_name = "xxx-xxx-xxx-xxx-xxx" + size = 100 + snapshot_id = (known after apply) + status = (known after apply) } # ovh_storage_efs_share_snapshot.snapshot will be created + resource "ovh_storage_efs_share_snapshot" "snapshot" { + created_at = (known after apply) + description = "My snapshot" + id = (known after apply) + name = "snapshot" + path = (known after apply) + service_name = "xxx-xxx-xxx-xxx-xxx" + share_id = (known after apply) + status = (known after apply) + type = (known after apply) } # time_sleep.wait_10_seconds will be created + resource "time_sleep" "wait_10_seconds" { + destroy_duration = "10s" + id = (known after apply) }Plan: 3 to add, 0 to change, 0 to destroy.Saved the plan to: main.tfplanTo perform exactly these actions, run the following command to apply: terraform apply "main.tfplan"
Key points:
The terraform plan command will create an execution plan but won't execute it. Instead, it will determine what actions are necessary to create the configuration specified inside your configuration files. This will allow you to verifiy whether your execution plan matches exectations before making any changes to actual resources.
The optional -out parameter allows your to specifiy an output file for the plan. It will ensure that the plan you reviewed will be the same as what is applied.
Once you reviewed the execution plan, run terraform apply to make changes:
terraform apply main.tfplanovh_storage_efs_share.volume: Creating...ovh_storage_efs_share.volume: Still creating... [10s elapsed]ovh_storage_efs_share.volume: Still creating... [20s elapsed]ovh_storage_efs_share.volume: Still creating... [30s elapsed]ovh_storage_efs_share.volume: Still creating... [40s elapsed]ovh_storage_efs_share.volume: Creation complete after 41s [id=1f551984-6529-48f8-830d-f6a70d062174]time_sleep.wait_10_seconds: Creating...time_sleep.wait_10_seconds: Creation complete after 0s [id=2025-07-01T13:39:01Z]ovh_storage_efs_share_snapshot.snapshot: Creating...ovh_storage_efs_share_snapshot.snapshot: Still creating... [10s elapsed]ovh_storage_efs_share_snapshot.snapshot: Creation complete after 10s [id=f92bc04a-301f-4a9a-80ba-7c7bf18b2275]Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
Your snapshot is now available.
Modify a snapshot
Snapshot name and description properties can be updated.
Once the value(s) are updated inside your main.tf file, apply the changes using terraform apply.
You can (re-)use a volume that already exists (within your Terraform configuration or not) to create your ACL.
resource "ovh_storage_efs_share" "volume" { service_name = "<service_id>" # Replace this value with service ID. name = "share" description = "My share" protocol = "NFS" size = 100}resource "ovh_storage_efs_share_acl" "acl" { service_name = "<service_id>" # Replace this value with service ID. share_id = ovh_storage_efs_share.volume.id access_level = "rw" access_to = "10.0.0.1/32"}
terraform plan -var-file=secrets.tfvars -out main.tfplanTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + createTerraform will perform the following actions: # ovh_storage_efs_share.volume will be created + resource "ovh_storage_efs_share" "volume" { + created_at = (known after apply) + description = "My share" + id = (known after apply) + mount_point_name = (known after apply) + name = "share" + protocol = "NFS" + service_name = "xxx-xxx-xxx-xxx-xxx" + size = 100 + snapshot_id = (known after apply) + status = (known after apply) } # ovh_storage_efs_share_acl.acl will be created + resource "ovh_storage_efs_share_acl" "acl" { + access_level = "rw" + access_to = "10.0.0.1/32" + access_type = (known after apply) + created_at = (known after apply) + id = (known after apply) + service_name = "xxx-xxx-xxx-xxx-xxx" + share_id = (known after apply) + status = (known after apply) }Plan: 2 to add, 0 to change, 0 to destroy.Saved the plan to: main.tfplanTo perform exactly these actions, run the following command to apply: terraform apply "main.tfplan"
Key points:
The terraform plan command will create an execution plan but won't execute it. Instead, it will determine what actions are necessary to create the configuration specified inside your configuration files. This will allow you to verifiy whether your execution plan matches exectations before making any changes to actual resources.
The optional -out parameter allows your to specifiy an output file for the plan. It will ensure that the plan you reviewed will be the same as what is applied.
Once you reviewed the execution plan, run terraform apply to make changes:
terraform apply main.tfplanovh_storage_efs_share.volume: Creating...ovh_storage_efs_share.volume: Still creating... [10s elapsed]ovh_storage_efs_share.volume: Creation complete after 10s [id=001ccf4b-3537-41c0-b446-a42663971d58]ovh_storage_efs_share_acl.acl: Creating...ovh_storage_efs_share_acl.acl: Still creating... [10s elapsed]ovh_storage_efs_share_acl.acl: Creation complete after 11s [id=9274f4d4-de96-46eb-935f-ffbc747a19bc]Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
terraform destroy -var-file=secrets.tfvarsovh_storage_efs_share.volume: Refreshing state... [id=001ccf4b-3537-41c0-b446-a42663971d58]ovh_storage_efs_share_acl.acl: Refreshing state... [id=9274f4d4-de96-46eb-935f-ffbc747a19bc]Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: - destroyTerraform will perform the following actions: # ovh_storage_efs_share.volume will be destroyed - resource "ovh_storage_efs_share" "volume" { - created_at = "2025-07-01T14:36:37Z" -> null - description = "My share" -> null - id = "001ccf4b-3537-41c0-b446-a42663971d58" -> null - name = "share" -> null - protocol = "NFS" -> null - service_name = "xxx-xxx-xxx-xxx-xxx" -> null - size = 100 -> null - status = "available" -> null # (1 unchanged attribute hidden) } # ovh_storage_efs_share_acl.acl will be destroyed - resource "ovh_storage_efs_share_acl" "acl" { - access_level = "rw" -> null - access_to = "10.0.0.1/32" -> null - access_type = "ip" -> null - created_at = "2025-07-01T14:36:48Z" -> null - id = "9274f4d4-de96-46eb-935f-ffbc747a19bc" -> null - service_name = "xxx-xxx-xxx-xxx-xxx" -> null - share_id = "001ccf4b-3537-41c0-b446-a42663971d58" -> null - status = "active" -> null }Plan: 0 to add, 0 to change, 2 to destroy.Do you really want to destroy all resources? Terraform will destroy all your managed infrastructure, as shown above. There is no undo. Only 'yes' will be accepted to confirm. Enter a value: yesovh_storage_efs_share_acl.acl: Destroying... [id=9274f4d4-de96-46eb-935f-ffbc747a19bc]ovh_storage_efs_share_acl.acl: Destruction complete after 0sovh_storage_efs_share.volume: Destroying... [id=001ccf4b-3537-41c0-b446-a42663971d58]ovh_storage_efs_share.volume: Destruction complete after 0sDestroy complete! Resources: 2 destroyed.
Troubleshooting
Authentication Issues: Verify API credentials and permissions.
Resource Limits: Check volume/snapshot quota usage in the OVHcloud Control Panel.
Volume Deletion Issues: Ensure all manual snapshots are deleted before removing the volume.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.