in astro/terraform/terraform_apply.go [24:58]
func (s *Session) Apply() (Result, error) {
if !s.Initialized() {
if result, err := s.Init(); err != nil {
return result, err
}
}
terraformVersion, err := s.versionCached()
if err != nil {
return nil, err
}
args := []string{"apply"}
if VersionMatches(terraformVersion, ">= 0.11") {
args = append(args, "-auto-approve")
}
for key, val := range s.config.Variables {
args = append(args, "-var", fmt.Sprintf("%s=%s", key, val))
}
args = append(args, s.config.TerraformParameters...)
process, err := s.terraformCommand(args, []int{0})
if err != nil {
return nil, err
}
err = process.Run()
return &terraformResult{
process: process,
}, err
}