hashicorp/terraform-provider-vault

[Bug]: Snapshot agent local_max_space 0 is not allowed

smirta opened this issue · 0 comments

Terraform Core Version

1.10.0

Terraform Vault Provider Version

4.3.0

Vault Server Version

1.17.2

Affected Resource(s)

  • vault_raft_snapshot_agent_config

Expected Behavior

Not entirely sure since this code part is not source available. But it seems that setting local_max_space to zero means no limit for storage used by snapshots when set manually in Vault.

Actual Behavior

According to the referenced code bits, setting local_max_space to zero is not allowed.

Relevant Error/Panic Output Snippet

vault_raft_snapshot_agent_config.local: Creating...
╷
│ Error: specified local storage without setting local_max_space
│ 
│   with vault_raft_snapshot_agent_config.local,
│   on snapshot-auto.tf line 1, in resource "vault_raft_snapshot_agent_config" "local":
│    1: resource "vault_raft_snapshot_agent_config" "local" {

Terraform Configuration Files

irrelevant

Steps to Reproduce

resource "vault_raft_snapshot_agent_config" "local" {
interval_seconds = 86400 # 24h
retain = 7
path_prefix = "/opt/vault/snapshots/"
storage_type = "local"
local_max_space = 0
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

I'd remove v != 0 or set it to v >= 0 in

if v, ok := d.GetOk("local_max_space"); ok && v != 0 {
if my assumptions are correct.