{
  "description": "Module implements API-driven Run Workflows.\nMore information:\n  - https://developer.hashicorp.com/terraform/cloud-docs/run/api",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "ModuleSpec defines the desired state of Module.",
      "properties": {
        "deletionPolicy": {
          "default": "retain",
          "description": "Deletion Policy defines the strategies for resource deletion in the Kubernetes operator.\nIt controls how the operator should handle the deletion of resources when triggered by\na user action or system event.\n\nThere is one possible value:\n- `retain`: When the custom resource is deleted, the associated module is retained. `destroyOnDeletion` must be set to false.\n- `destroy`: Executes a destroy operation. Removes all resources and the module.\nDefault: `retain`.",
          "enum": [
            "retain",
            "destroy"
          ],
          "type": "string"
        },
        "destroyOnDeletion": {
          "default": false,
          "description": "DEPRECATED: Specify whether or not to execute a Destroy run when the object is deleted from the Kubernetes.\nDefault: `false`.",
          "type": "boolean"
        },
        "module": {
          "description": "Module source and version to execute.",
          "properties": {
            "source": {
              "description": "Non local Terraform module source.\nMore information:\n  - https://developer.hashicorp.com/terraform/language/modules/sources",
              "minLength": 1,
              "type": "string"
            },
            "version": {
              "description": "Terraform module version.",
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "source"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "name": {
          "default": "this",
          "description": "Name of the module that will be uploaded and executed.\nDefault: `this`.",
          "minLength": 1,
          "type": "string"
        },
        "organization": {
          "description": "Organization name where the Workspace will be created.\nMore information:\n  - https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/organizations",
          "minLength": 1,
          "type": "string"
        },
        "outputs": {
          "description": "Module outputs to store in ConfigMap(non-sensitive) or Secret(sensitive).",
          "items": {
            "description": "Module outputs to store in ConfigMap(non-sensitive) or Secret(sensitive).",
            "properties": {
              "name": {
                "description": "Output name must match with the module output.",
                "minLength": 1,
                "type": "string"
              },
              "sensitive": {
                "default": false,
                "description": "Specify whether or not the output is sensitive.\nDefault: `false`.",
                "type": "boolean"
              }
            },
            "required": [
              "name"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "minItems": 1,
          "type": "array"
        },
        "restartedAt": {
          "description": "Allows executing a new Run without changing any Workspace or Module attributes.\nExample: kubectl patch <KIND> <NAME> --type=merge --patch '{\"spec\": {\"restartedAt\": \"'\\`date -u -Iseconds\\`'\"}}'",
          "minLength": 1,
          "type": "string"
        },
        "token": {
          "description": "API Token to be used for API calls.",
          "properties": {
            "secretKeyRef": {
              "description": "Selects a key of a secret in the workspace's namespace",
              "properties": {
                "key": {
                  "description": "The key of the secret to select from.  Must be a valid secret key.",
                  "type": "string"
                },
                "name": {
                  "default": "",
                  "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                },
                "optional": {
                  "description": "Specify whether the Secret or its key must be defined",
                  "type": "boolean"
                }
              },
              "required": [
                "key"
              ],
              "type": "object",
              "x-kubernetes-map-type": "atomic",
              "additionalProperties": false
            }
          },
          "required": [
            "secretKeyRef"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "variables": {
          "description": "Variables to pass to the module, they must exist in the Workspace.",
          "items": {
            "description": "Variables to pass to the module.",
            "properties": {
              "name": {
                "description": "Variable name must exist in the Workspace.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "minItems": 1,
          "type": "array"
        },
        "workspace": {
          "description": "Workspace to execute the module.",
          "properties": {
            "id": {
              "description": "Module Workspace ID.\nMust match pattern: `^ws-[a-zA-Z0-9]+$`",
              "pattern": "^ws-[a-zA-Z0-9]+$",
              "type": "string"
            },
            "name": {
              "description": "Module Workspace Name.",
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "module",
        "organization",
        "token",
        "workspace"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "ModuleStatus defines the observed state of Module.",
      "properties": {
        "configurationVersion": {
          "description": "A configuration version is a resource used to reference the uploaded configuration files.\nMore information:\n  - https://developer.hashicorp.com/terraform/cloud-docs/api-docs/configuration-versions\n  - https://developer.hashicorp.com/terraform/cloud-docs/run/api",
          "properties": {
            "id": {
              "description": "Configuration Version ID.",
              "type": "string"
            },
            "status": {
              "description": "Configuration Version Status.",
              "type": "string"
            }
          },
          "required": [
            "id",
            "status"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "destroyRunID": {
          "description": "Workspace Destroy Run ID.",
          "type": "string"
        },
        "observedGeneration": {
          "description": "Real world state generation.",
          "format": "int64",
          "type": "integer"
        },
        "output": {
          "description": "Module Outputs status.",
          "properties": {
            "runID": {
              "description": "Run ID of the latest run that updated the outputs.",
              "type": "string"
            }
          },
          "required": [
            "runID"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "run": {
          "description": "Workspace Runs status.\nMore information:\n  - https://developer.hashicorp.com/terraform/cloud-docs/run/states",
          "properties": {
            "configurationVersion": {
              "description": "The configuration version of this run.",
              "type": "string"
            },
            "id": {
              "description": "Current(both active and finished) HCP Terraform run ID.",
              "type": "string"
            },
            "outputRunID": {
              "description": "Run ID of the latest run that could update the outputs.",
              "type": "string"
            },
            "status": {
              "description": "Current(both active and finished) HCP Terraform run status.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "workspaceID": {
          "description": "Workspace ID where the module is running.",
          "type": "string"
        }
      },
      "required": [
        "observedGeneration",
        "workspaceID"
      ],
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
