README.md

June 10, 2026 ยท View on GitHub

Description

This module creates a script that defines a software build using Spack and performs any additional customization to a Spack installation.

There are two main variable inputs that can be used to define a Spack build: data_files and commands.

  • data_files: Any files specified will be transferred to the machine running outputted script. Data file content can be defined inline in the blueprint or can point to a source, an absolute local path of a file. This can be used to transfer environment definition files, config definition files, GPG keys, or software licenses. data_files are transferred before commands are run.
  • commands: A script that is run. This can be used to perform actions such as installation of compilers & packages, environment creation, adding a build cache, and modifying the spack configuration.

Example

The spack-execute module should use a spack-setup module. This will prepend the installation of Spack and its dependencies to the build. Then spack-execute can be used by a module that takes startup-script as an input.

  - id: spack-setup
    source: community/modules/scripts/spack-setup

  - id: spack-build
    source: community/modules/scripts/spack-execute
    use: [spack-setup]
    settings:
      commands: |
        spack install gcc@10.3.0 target=x86_64

  - id: builder-vm
    source: modules/compute/vm-instance
    use: [network1, spack-build]

To see a full example of this module in use, see the hpc-slurm-gromacs.yaml example.

Using with startup-script module

The spack-runner output can be used by the startup-script module.

  - id: spack-setup
    source: community/modules/scripts/spack-setup

  - id: spack-build
    source: community/modules/scripts/spack-execute
    use: [spack-setup]
    settings:
      commands: |
        spack install gcc@10.3.0 target=x86_64

  - id: startup-script
    source: modules/scripts/startup-script
    settings:
      runners:
      - $(spack-build.spack-runner)
      - type: shell
        destination: "my-script.sh"
        content: echo 'hello world'

  - id: workstation
    source: modules/compute/vm-instance
    use: [network1, startup-script]

License

Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Requirements

NameVersion
terraform>= 1.12.2
local>= 2.0.0

Providers

NameVersion
local>= 2.0.0

Modules

NameSourceVersion
startup_script../../../../modules/scripts/startup-scriptn/a

Resources

NameType
local_file.debug_file_ansible_executeresource

Inputs

NameDescriptionTypeDefaultRequired
commandsString of commands to run within this modulestringnullno
data_filesA list of files to be transferred prior to running commands.
It must specify one of 'source' (absolute local file path) or 'content' (string).
It must specify a 'destination' with absolute path where file should be placed.
list(map(string))[]no
deployment_nameName of deployment, used to name bucket containing spack scripts.stringn/ayes
gcs_bucket_pathThe GCS path for storage bucket and the object, starting with gs://.stringn/ayes
labelsKey-value pairs of labels to be added to created resources.map(string)n/ayes
log_fileDefines the logfile that script output will be written tostring"/var/log/spack.log"no
project_idProject in which the HPC deployment will be created.stringn/ayes
regionRegion to place bucket containing spack scripts.stringn/ayes
spack_profile_script_pathPath to the Spack profile.d script. Created by an instance of spack-setup.
Can be defined explicitly, or by chaining an instance of a spack-setup module
through a use setting.
stringn/ayes
spack_runnerRunner from previous spack-setup or spack-execute to be chained with scripts generated by this module.
object({
type = string
content = string
destination = string
})
n/ayes
system_user_nameName of the system user used to execute commands. Generally passed from the spack-setup module.stringn/ayes

Outputs

NameDescription
controller_startup_scriptSpack startup script, duplicate for SLURM controller.
gcs_bucket_pathBucket containing the startup scripts for spack, to be reused by spack-execute module.
spack_profile_script_pathPath to the Spack profile.d script.
spack_runnerSingle runner that combines scripts from this module and any previously chained spack-execute or spack-setup modules.
startup_scriptSpack startup script.
system_user_nameThe system user used to execute commands.