func()

in tf/terraform.go [87:101]


func (t *Terraform) ImportAdd(address string, id string) (string, error) {
	_ = t.Init()
	err := t.exec.Import(context.TODO(), address, id)
	if err != nil {
		return "", fmt.Errorf("importing resource %s: %w", address, err)
	}
	outputs, err := tfadd.StateForTargets(context.TODO(), t.exec, []string{address}, tfadd.Full(true))
	if err != nil {
		return "", fmt.Errorf("converting terraform state to config for resource %s: %w", address, err)
	}
	if len(outputs) == 0 {
		return "", fmt.Errorf("resource %s not found in state", address)
	}
	return string(outputs[0]), nil
}