Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add context argument to resource.nomad_csi_volume #503

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nomad/resource_csi_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ func resourceCSIVolume() *schema.Resource {
Computed: true,
Type: schema.TypeString,
},
"context": {
Description: "The volume context provided by the storage provider",
Computed: true,
Type: schema.TypeMap,
},
},
}
}
Expand Down Expand Up @@ -402,6 +407,7 @@ func resourceCSIVolumeRead(d *schema.ResourceData, meta interface{}) error {
d.Set("capability", flattenCSIVolumeCapabilities(volume.RequestedCapabilities))
d.Set("topologies", flattenCSIVolumeTopologies(volume.Topologies))
d.Set("topology_request", flattenCSIVolumeTopologyRequests(volume.RequestedTopologies))
d.Set("context", volume.Context)
// The Nomad API redacts `mount_options` and `secrets`, so we don't update them
// with the response payload; they will remain as is.

Expand Down Expand Up @@ -451,6 +457,7 @@ func resourceCSIVolumeCreate(ctx context.Context, d *schema.ResourceData, meta i
RequestedTopologies: topologyRequest,
Secrets: helper.ToMapStringString(d.Get("secrets")),
Parameters: helper.ToMapStringString(d.Get("parameters")),
Context: helper.ToMapStringString(d.Get("context")),
}

// Unpack the mount_options if we have any and configure the volume struct.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/csi_volume.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ can be referenced:
- `nodes_expected`: `(integer)`
- `schedulable`: `(boolean)`
- `topologies`: `(List of topologies)`
- `context`: `(map[string]string)`

### Timeouts

Expand Down
Loading