From 8a7953896e7a7630dacd83c4e74b04256d446f03 Mon Sep 17 00:00:00 2001 From: Nicholas Wiersma Date: Fri, 19 Jul 2024 13:07:33 +0200 Subject: [PATCH] feat: support formations and vessels (#31) --- docs/data-sources/formation_formation.md | 466 ++++++++++++++ .../formation_formation_v1beta1.md | 466 ++++++++++++++ docs/data-sources/formation_vessel.md | 396 ++++++++++++ docs/data-sources/formation_vessel_v1beta1.md | 396 ++++++++++++ docs/resources/formation_formation.md | 466 ++++++++++++++ docs/resources/formation_formation_v1beta1.md | 466 ++++++++++++++ docs/resources/formation_vessel.md | 396 ++++++++++++ docs/resources/formation_vessel_v1beta1.md | 396 ++++++++++++ ec/formation/data_source_formation.go | 26 + ec/formation/data_source_formation_test.go | 92 +++ ec/formation/data_source_vessel.go | 26 + ec/formation/data_source_vessel_test.go | 89 +++ ec/formation/resource_formation.go | 129 ++++ ec/formation/resource_formation_test.go | 157 +++++ ec/formation/resource_vessel.go | 129 ++++ ec/formation/resource_vessel_test.go | 151 +++++ ec/formation/schema_env.go | 63 ++ ec/formation/schema_formation.go | 590 ++++++++++++++++++ ec/formation/schema_vessel.go | 528 ++++++++++++++++ ec/provider/provider.go | 61 +- go.mod | 2 +- go.sum | 4 +- internal/cmd/schema-gen/main.go | 19 + 23 files changed, 5485 insertions(+), 29 deletions(-) create mode 100644 docs/data-sources/formation_formation.md create mode 100644 docs/data-sources/formation_formation_v1beta1.md create mode 100644 docs/data-sources/formation_vessel.md create mode 100644 docs/data-sources/formation_vessel_v1beta1.md create mode 100644 docs/resources/formation_formation.md create mode 100644 docs/resources/formation_formation_v1beta1.md create mode 100644 docs/resources/formation_vessel.md create mode 100644 docs/resources/formation_vessel_v1beta1.md create mode 100644 ec/formation/data_source_formation.go create mode 100644 ec/formation/data_source_formation_test.go create mode 100644 ec/formation/data_source_vessel.go create mode 100644 ec/formation/data_source_vessel_test.go create mode 100644 ec/formation/resource_formation.go create mode 100644 ec/formation/resource_formation_test.go create mode 100644 ec/formation/resource_vessel.go create mode 100644 ec/formation/resource_vessel_test.go create mode 100644 ec/formation/schema_env.go create mode 100644 ec/formation/schema_formation.go create mode 100644 ec/formation/schema_vessel.go diff --git a/docs/data-sources/formation_formation.md b/docs/data-sources/formation_formation.md new file mode 100644 index 0000000..c37c1cd --- /dev/null +++ b/docs/data-sources/formation_formation.md @@ -0,0 +1,466 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_formation Data Source - terraform-provider-ec" +subcategory: "" +description: |- + Use this data source to access information about an existing Formation. +--- + +# ec_formation_formation (Data Source) + +Use this data source to access information about an existing Formation. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessels in this formation. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) +- `vessels` (Block List, Min: 1) Vessels is a list of vessels belonging to the formation. (see [below for nested schema](#nestedblock--spec--vessels)) + +Optional: + +- `description` (String) Description is the optional description of the formation. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. + + + + + + +### Nested Schema for `spec.vessels` + +Required: + +- `name` (String) Name is the name of the vessel. +- `region` (String) Region defines the region the vessel is deployed to. + +Optional: + +- `description` (String) Description is the optional description of the vessel. +- `override` (Block List, Max: 1) Override describes how the game server is configured for this vessel. (see [below for nested schema](#nestedblock--spec--vessels--override)) + + +### Nested Schema for `spec.vessels.override` + +Optional: + +- `containers` (Block List) Containers is a list of container override values. (see [below for nested schema](#nestedblock--spec--vessels--override--containers)) +- `labels` (Map of String) Labels is a map of keys and values that can be used to organize and categorize objects. + + +### Nested Schema for `spec.vessels.override.containers` + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `env` (Block List) Env is a list of environment variables to set on containers. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env)) + + +### Nested Schema for `spec.vessels.override.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) diff --git a/docs/data-sources/formation_formation_v1beta1.md b/docs/data-sources/formation_formation_v1beta1.md new file mode 100644 index 0000000..795a824 --- /dev/null +++ b/docs/data-sources/formation_formation_v1beta1.md @@ -0,0 +1,466 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_formation_v1beta1 Data Source - terraform-provider-ec" +subcategory: "" +description: |- + Use this data source to access information about an existing Formation. +--- + +# ec_formation_formation_v1beta1 (Data Source) + +Use this data source to access information about an existing Formation. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessels in this formation. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) +- `vessels` (Block List, Min: 1) Vessels is a list of vessels belonging to the formation. (see [below for nested schema](#nestedblock--spec--vessels)) + +Optional: + +- `description` (String) Description is the optional description of the formation. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. + + + + + + +### Nested Schema for `spec.vessels` + +Required: + +- `name` (String) Name is the name of the vessel. +- `region` (String) Region defines the region the vessel is deployed to. + +Optional: + +- `description` (String) Description is the optional description of the vessel. +- `override` (Block List, Max: 1) Override describes how the game server is configured for this vessel. (see [below for nested schema](#nestedblock--spec--vessels--override)) + + +### Nested Schema for `spec.vessels.override` + +Optional: + +- `containers` (Block List) Containers is a list of container override values. (see [below for nested schema](#nestedblock--spec--vessels--override--containers)) +- `labels` (Map of String) Labels is a map of keys and values that can be used to organize and categorize objects. + + +### Nested Schema for `spec.vessels.override.containers` + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `env` (Block List) Env is a list of environment variables to set on containers. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env)) + + +### Nested Schema for `spec.vessels.override.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) diff --git a/docs/data-sources/formation_vessel.md b/docs/data-sources/formation_vessel.md new file mode 100644 index 0000000..110b473 --- /dev/null +++ b/docs/data-sources/formation_vessel.md @@ -0,0 +1,396 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_vessel Data Source - terraform-provider-ec" +subcategory: "" +description: |- + Use this data source to access information about an existing Vessel. +--- + +# ec_formation_vessel (Data Source) + +Use this data source to access information about an existing Vessel. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessel. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `region` (String) Region defines the region the vessel is deployed to. +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) + +Optional: + +- `description` (String) Description is the optional description of the vessel. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. diff --git a/docs/data-sources/formation_vessel_v1beta1.md b/docs/data-sources/formation_vessel_v1beta1.md new file mode 100644 index 0000000..9f8399b --- /dev/null +++ b/docs/data-sources/formation_vessel_v1beta1.md @@ -0,0 +1,396 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_vessel_v1beta1 Data Source - terraform-provider-ec" +subcategory: "" +description: |- + Use this data source to access information about an existing Vessel. +--- + +# ec_formation_vessel_v1beta1 (Data Source) + +Use this data source to access information about an existing Vessel. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessel. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `region` (String) Region defines the region the vessel is deployed to. +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) + +Optional: + +- `description` (String) Description is the optional description of the vessel. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. diff --git a/docs/resources/formation_formation.md b/docs/resources/formation_formation.md new file mode 100644 index 0000000..bf8ceec --- /dev/null +++ b/docs/resources/formation_formation.md @@ -0,0 +1,466 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_formation Resource - terraform-provider-ec" +subcategory: "" +description: |- + A Formation is a configuration for multiple vessels. +--- + +# ec_formation_formation (Resource) + +A Formation is a configuration for multiple vessels. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessels in this formation. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) +- `vessels` (Block List, Min: 1) Vessels is a list of vessels belonging to the formation. (see [below for nested schema](#nestedblock--spec--vessels)) + +Optional: + +- `description` (String) Description is the optional description of the formation. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. + + + + + + +### Nested Schema for `spec.vessels` + +Required: + +- `name` (String) Name is the name of the vessel. +- `region` (String) Region defines the region the vessel is deployed to. + +Optional: + +- `description` (String) Description is the optional description of the vessel. +- `override` (Block List, Max: 1) Override describes how the game server is configured for this vessel. (see [below for nested schema](#nestedblock--spec--vessels--override)) + + +### Nested Schema for `spec.vessels.override` + +Optional: + +- `containers` (Block List) Containers is a list of container override values. (see [below for nested schema](#nestedblock--spec--vessels--override--containers)) +- `labels` (Map of String) Labels is a map of keys and values that can be used to organize and categorize objects. + + +### Nested Schema for `spec.vessels.override.containers` + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `env` (Block List) Env is a list of environment variables to set on containers. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env)) + + +### Nested Schema for `spec.vessels.override.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) diff --git a/docs/resources/formation_formation_v1beta1.md b/docs/resources/formation_formation_v1beta1.md new file mode 100644 index 0000000..9e57571 --- /dev/null +++ b/docs/resources/formation_formation_v1beta1.md @@ -0,0 +1,466 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_formation_v1beta1 Resource - terraform-provider-ec" +subcategory: "" +description: |- + A Formation is a configuration for multiple vessels. +--- + +# ec_formation_formation_v1beta1 (Resource) + +A Formation is a configuration for multiple vessels. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessels in this formation. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) +- `vessels` (Block List, Min: 1) Vessels is a list of vessels belonging to the formation. (see [below for nested schema](#nestedblock--spec--vessels)) + +Optional: + +- `description` (String) Description is the optional description of the formation. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. + + + + + + +### Nested Schema for `spec.vessels` + +Required: + +- `name` (String) Name is the name of the vessel. +- `region` (String) Region defines the region the vessel is deployed to. + +Optional: + +- `description` (String) Description is the optional description of the vessel. +- `override` (Block List, Max: 1) Override describes how the game server is configured for this vessel. (see [below for nested schema](#nestedblock--spec--vessels--override)) + + +### Nested Schema for `spec.vessels.override` + +Optional: + +- `containers` (Block List) Containers is a list of container override values. (see [below for nested schema](#nestedblock--spec--vessels--override--containers)) +- `labels` (Map of String) Labels is a map of keys and values that can be used to organize and categorize objects. + + +### Nested Schema for `spec.vessels.override.containers` + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `env` (Block List) Env is a list of environment variables to set on containers. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env)) + + +### Nested Schema for `spec.vessels.override.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--vessels--override--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.vessels.override.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) diff --git a/docs/resources/formation_vessel.md b/docs/resources/formation_vessel.md new file mode 100644 index 0000000..0449c77 --- /dev/null +++ b/docs/resources/formation_vessel.md @@ -0,0 +1,396 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_vessel Resource - terraform-provider-ec" +subcategory: "" +description: |- + A Vessel is the specification of a game server to be deployed on a specific Region.. +--- + +# ec_formation_vessel (Resource) + +A Vessel is the specification of a game server to be deployed on a specific Region.. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessel. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `region` (String) Region defines the region the vessel is deployed to. +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) + +Optional: + +- `description` (String) Description is the optional description of the vessel. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. diff --git a/docs/resources/formation_vessel_v1beta1.md b/docs/resources/formation_vessel_v1beta1.md new file mode 100644 index 0000000..79b780e --- /dev/null +++ b/docs/resources/formation_vessel_v1beta1.md @@ -0,0 +1,396 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "ec_formation_vessel_v1beta1 Resource - terraform-provider-ec" +subcategory: "" +description: |- + A Vessel is the specification of a game server to be deployed on a specific Region.. +--- + +# ec_formation_vessel_v1beta1 (Resource) + +A Vessel is the specification of a game server to be deployed on a specific Region.. + + + + +## Schema + +### Optional + +- `instance` (String) Name is an instance name configured in the provider. +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired vessel. (see [below for nested schema](#nestedblock--spec)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec` + +Required: + +- `region` (String) Region defines the region the vessel is deployed to. +- `template` (Block List, Min: 1, Max: 1) Template describes the game server that is created. (see [below for nested schema](#nestedblock--spec--template)) + +Optional: + +- `description` (String) Description is the optional description of the vessel. + + +### Nested Schema for `spec.template` + +Optional: + +- `metadata` (Block List, Max: 1) Standard object's metadata. (see [below for nested schema](#nestedblock--spec--template--metadata)) +- `spec` (Block List, Max: 1) Spec defines the desired game server. (see [below for nested schema](#nestedblock--spec--template--spec)) + + +### Nested Schema for `spec.template.metadata` + +Optional: + +- `annotations` (Map of String) An unstructured map of keys and values stored on an object. +- `environment` (String) The name of the environment the object belongs to. +- `labels` (Map of String) A map of keys and values that can be used to organize and categorize objects. +- `name` (String) The unique object name within its scope. + +Read-Only: + +- `revision` (String) An opaque resource revision. +- `uid` (String) A unique identifier for each an object. + + + +### Nested Schema for `spec.template.spec` + +Required: + +- `containers` (Block List, Min: 1) Containers is a list of container belonging to the game server. (see [below for nested schema](#nestedblock--spec--template--spec--containers)) + +Optional: + +- `health` (Block List, Max: 1) Health is the health checking configuration for Agones game servers. (see [below for nested schema](#nestedblock--spec--template--spec--health)) +- `volumes` (Block List) Volumes are pod volumes. (see [below for nested schema](#nestedblock--spec--template--spec--volumes)) + + +### Nested Schema for `spec.template.spec.containers` + +Required: + +- `branch` (String) Branch is the name of the image branch. +- `image` (String) Image is a reference to the containerv1.Image to deploy in this container. +- `name` (String) Name is the name of the container. + +Optional: + +- `args` (List of String) Args are arguments to the entrypoint. +- `command` (List of String) Command is the entrypoint array. This is not executed within a shell. +- `config_files` (Block List) ConfigFiles is a list of configuration files to mount into the containers filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--config_files)) +- `env` (Block List) Env is a list of environment variables to set in the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env)) +- `ports` (Block List) Ports are the ports to expose from the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--ports)) +- `resources` (Block List, Max: 1) Resources are the compute resources required by the container. (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources)) +- `security_context` (Block List, Max: 1) SecurityContext defines the security options the container should be run with. (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context)) +- `volume_mounts` (Block List) VolumeMounts are the volumes to mount into the container's filesystem. (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts)) + + +### Nested Schema for `spec.template.spec.containers.config_files` + +Required: + +- `mount_path` (String) MountPath is the path to mount the configuration file on. +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env` + +Required: + +- `name` (String) Name is the name of the environment variable. + +Optional: + +- `value` (String) Value is the value of the environment variable. +- `value_from` (Block List, Max: 1) ValueFrom is the source for the environment variable's value. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from` + +Optional: + +- `config_file_key_ref` (Block List, Max: 1) ConfigFileKeyRef select the configuration file. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--config_file_key_ref)) +- `field_ref` (Block List, Max: 1) FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. (see [below for nested schema](#nestedblock--spec--template--spec--containers--env--value_from--field_ref)) + + +### Nested Schema for `spec.template.spec.containers.env.value_from.config_file_key_ref` + +Required: + +- `name` (String) Name is the name of the configuration file. + + + +### Nested Schema for `spec.template.spec.containers.env.value_from.field_ref` + +Optional: + +- `api_version` (String) +- `field_path` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.ports` + +Required: + +- `name` (String) Name is the name of the port. +- `policy` (String) Policy defines the policy for how the HostPort is populated. + +Optional: + +- `container_port` (Number) ContainerPort is the port that is being opened on the specified container's process. +- `protocol` (String) Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. + + + +### Nested Schema for `spec.template.spec.containers.resources` + +Optional: + +- `claims` (Block List) (see [below for nested schema](#nestedblock--spec--template--spec--containers--resources--claims)) +- `limits` (Map of String) +- `requests` (Map of String) + + +### Nested Schema for `spec.template.spec.containers.resources.claims` + +Optional: + +- `name` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context` + +Optional: + +- `allow_privilege_escalation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--allow_privilege_escalation)) +- `capabilities` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--capabilities)) +- `privileged` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--privileged)) +- `proc_mount` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--proc_mount)) +- `read_only_root_filesystem` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--read_only_root_filesystem)) +- `run_as_group` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_group)) +- `run_as_non_root` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_non_root)) +- `run_as_user` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--run_as_user)) +- `se_linux_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--se_linux_options)) +- `seccomp_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile)) +- `windows_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options)) + + +### Nested Schema for `spec.template.spec.containers.security_context.allow_privilege_escalation` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.capabilities` + +Optional: + +- `add` (List of String) +- `drop` (List of String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.privileged` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.proc_mount` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.read_only_root_filesystem` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_group` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_non_root` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.run_as_user` + +Required: + +- `value` (Number) + + + +### Nested Schema for `spec.template.spec.containers.security_context.se_linux_options` + +Optional: + +- `level` (String) +- `role` (String) +- `type` (String) +- `user` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile` + +Optional: + +- `localhost_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--seccomp_profile--localhost_profile)) +- `type` (String) + + +### Nested Schema for `spec.template.spec.containers.security_context.seccomp_profile.localhost_profile` + +Required: + +- `value` (String) + + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options` + +Optional: + +- `gmsa_credential_spec` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec)) +- `gmsa_credential_spec_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--gmsa_credential_spec_name)) +- `host_process` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--host_process)) +- `run_as_user_name` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--security_context--windows_options--run_as_user_name)) + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.gmsa_credential_spec_name` + +Required: + +- `value` (String) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.host_process` + +Required: + +- `value` (Boolean) + + + +### Nested Schema for `spec.template.spec.containers.security_context.windows_options.run_as_user_name` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.containers.volume_mounts` + +Optional: + +- `mount_path` (String) +- `mount_propagation` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--template--spec--containers--volume_mounts--mount_propagation)) +- `name` (String) +- `read_only` (Boolean) +- `sub_path` (String) +- `sub_path_expr` (String) + + +### Nested Schema for `spec.template.spec.containers.volume_mounts.mount_propagation` + +Required: + +- `value` (String) + + + + + +### Nested Schema for `spec.template.spec.health` + +Optional: + +- `disabled` (Boolean) +- `failure_threshold` (Number) +- `initial_delay_seconds` (Number) +- `period_seconds` (Number) + + + +### Nested Schema for `spec.template.spec.volumes` + +Required: + +- `name` (String) Name is the name of the volume mount. + +Optional: + +- `medium` (String) Medium is the storage medium type. +- `size_limit` (Block List, Max: 1) SizeLimit is the maximum size of the volume. (see [below for nested schema](#nestedblock--spec--template--spec--volumes--size_limit)) + + +### Nested Schema for `spec.template.spec.volumes.size_limit` + +Required: + +- `value` (String) SizeLimit is the maximum size of the volume. diff --git a/ec/formation/data_source_formation.go b/ec/formation/data_source_formation.go new file mode 100644 index 0000000..d7a2f19 --- /dev/null +++ b/ec/formation/data_source_formation.go @@ -0,0 +1,26 @@ +package formation + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/nitrado/terraform-provider-ec/ec" +) + +// DataSourceFormation returns the data source resource for a Formation. +func DataSourceFormation() *schema.Resource { + return &schema.Resource{ + Description: "Use this data source to access information about an existing Formation.", + ReadContext: dataSourceFormationRead, + Schema: formationSchema(), + } +} + +func dataSourceFormationRead(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + name := d.Get("metadata.0.name").(string) + env := d.Get("metadata.0.environment").(string) + d.SetId(ec.ScopedName(env, name)) + + return resourceFormationRead(ctx, d, m) +} diff --git a/ec/formation/data_source_formation_test.go b/ec/formation/data_source_formation_test.go new file mode 100644 index 0000000..2d686ad --- /dev/null +++ b/ec/formation/data_source_formation_test.go @@ -0,0 +1,92 @@ +package formation_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/nitrado/terraform-provider-ec/ec/provider/providertest" +) + +func TestDataSourceFormations(t *testing.T) { + name := "my-armadaset" + env := "dflt" + pf, _ := providertest.SetupProviderFactories(t) + + resource.Test(t, resource.TestCase{ + IsUnitTest: true, + ProviderFactories: pf, + Steps: []resource.TestStep{ + { + Config: testDataSourceFormationConfigBasic(name, env), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.#", "1"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.description", "My Formation"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.vessels.0.region", "eu"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + ), + }, + { + Config: testDataSourceFormationConfigBasic(name, env) + + testDataSourceFormationConfigRead(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.#", "1"), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.0.description", "My Formation"), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.0.vessels.0.region", "eu"), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("data.ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + ), + }, + }, + }) +} + +func testDataSourceFormationConfigBasic(name, env string) string { + return fmt.Sprintf(`resource "ec_formation_formation" "test" { + metadata { + name = "%s" + environment = "%s" + } + spec { + description = "My Formation" + vessels { + name = "eu-vessel" + region = "eu" + } + template { + metadata { + labels = { + "foo" = "bar" + } + } + spec { + containers { + name = "my-ctr" + branch = "prod" + image = "test-xyz" + } + } + } + } +} +`, name, env) +} + +func testDataSourceFormationConfigRead() string { + return `data "ec_formation_formation" "test" { + metadata { + name = "${ec_formation_formation.test.metadata.0.name}" + environment = "${ec_formation_formation.test.metadata.0.environment}" + } +} +` +} diff --git a/ec/formation/data_source_vessel.go b/ec/formation/data_source_vessel.go new file mode 100644 index 0000000..99cb72f --- /dev/null +++ b/ec/formation/data_source_vessel.go @@ -0,0 +1,26 @@ +package formation + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/nitrado/terraform-provider-ec/ec" +) + +// DataSourceVessel returns the data source resource for a Vessel. +func DataSourceVessel() *schema.Resource { + return &schema.Resource{ + Description: "Use this data source to access information about an existing Vessel.", + ReadContext: dataSourceVesselRead, + Schema: vesselSchema(), + } +} + +func dataSourceVesselRead(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + name := d.Get("metadata.0.name").(string) + env := d.Get("metadata.0.environment").(string) + d.SetId(ec.ScopedName(env, name)) + + return resourceVesselRead(ctx, d, m) +} diff --git a/ec/formation/data_source_vessel_test.go b/ec/formation/data_source_vessel_test.go new file mode 100644 index 0000000..3f9efe1 --- /dev/null +++ b/ec/formation/data_source_vessel_test.go @@ -0,0 +1,89 @@ +package formation_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/nitrado/terraform-provider-ec/ec/provider/providertest" +) + +func TestDataSourceVessels(t *testing.T) { + name := "my-vessel" + env := "dflt" + pf, _ := providertest.SetupProviderFactories(t) + + resource.Test(t, resource.TestCase{ + IsUnitTest: true, + ProviderFactories: pf, + Steps: []resource.TestStep{ + { + Config: testDataSourceVesselsConfigBasic(name, env), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ec_formation_vessel.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.#", "1"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.description", "My Vessel"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.region", "eu"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + ), + }, + { + Config: testDataSourceVesselsConfigBasic(name, env) + + testDataSourceVesselConfigRead(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.#", "1"), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.0.description", "My Vessel"), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.0.region", "eu"), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("data.ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + ), + }, + }, + }) +} + +func testDataSourceVesselsConfigBasic(name, env string) string { + return fmt.Sprintf(`resource "ec_formation_vessel" "test" { + metadata { + name = "%s" + environment = "%s" + } + spec { + description = "My Vessel" + region = "eu" + template { + metadata { + labels = { + "foo" = "bar" + } + } + spec { + containers { + name = "my-ctr" + branch = "prod" + image = "test-xyz" + } + } + } + } +} +`, name, env) +} + +func testDataSourceVesselConfigRead() string { + return `data "ec_formation_vessel" "test" { + metadata { + name = "${ec_formation_vessel.test.metadata.0.name}" + environment = "${ec_formation_vessel.test.metadata.0.environment}" + } +} +` +} diff --git a/ec/formation/resource_formation.go b/ec/formation/resource_formation.go new file mode 100644 index 0000000..cb9c707 --- /dev/null +++ b/ec/formation/resource_formation.go @@ -0,0 +1,129 @@ +package formation + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/nitrado/terraform-provider-ec/ec" + "github.com/nitrado/terraform-provider-ec/pkg/resource" + "gitlab.com/nitrado/b2b/ec/apicore/api/errors" + metav1 "gitlab.com/nitrado/b2b/ec/apicore/apis/meta/v1" + formationv1beta1 "gitlab.com/nitrado/b2b/ec/core/pkg/api/formation/v1beta1" +) + +// ResourceFormation returns the resource for a Formation. +func ResourceFormation() *schema.Resource { + return &schema.Resource{ + Description: "A Formation is a configuration for multiple vessels.", + ReadContext: resourceFormationRead, + CreateContext: resourceFormationCreate, + UpdateContext: resourceFormationUpdate, + DeleteContext: resourceFormationDelete, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Schema: formationSchema(), + } +} + +func resourceFormationRead(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + env, name := ec.SplitName(d.Id()) + + obj, err := clientSet.FormationV1Beta1().Formations(env).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + switch { + case errors.IsNotFound(err): + d.SetId("") + return nil + default: + return diag.FromErr(err) + } + } + + data, err := ec.Converter().Flatten(obj, formationSchema()) + if err != nil { + return diag.FromErr(err) + } + + if err = resource.SetData(d, data); err != nil { + return diag.FromErr(err) + } + return nil +} + +func resourceFormationCreate(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + obj := &formationv1beta1.Formation{} + if err = ec.Converter().Expand(d.Get("metadata").([]any), &obj.ObjectMeta); err != nil { + return diag.FromErr(err) + } + if err = ec.Converter().Expand(d.Get("spec").([]any), &obj.Spec); err != nil { + return diag.FromErr(err) + } + + out, err := clientSet.FormationV1Beta1().Formations(obj.Environment).Create(ctx, obj, metav1.CreateOptions{}) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(ec.ScopedName(out.Environment, out.Name)) + return resourceFormationRead(ctx, d, m) +} + +func resourceFormationUpdate(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + obj := &formationv1beta1.Formation{} + if err = ec.Converter().Expand(d.Get("metadata").([]any), &obj.ObjectMeta); err != nil { + return diag.FromErr(err) + } + if err = ec.Converter().Expand(d.Get("spec").([]any), &obj.Spec); err != nil { + return diag.FromErr(err) + } + + out, err := clientSet.FormationV1Beta1().Formations(obj.Environment).Update(ctx, obj, metav1.UpdateOptions{}) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(ec.ScopedName(out.Environment, out.Name)) + return resourceFormationRead(ctx, d, m) +} + +func resourceFormationDelete(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + env, name := ec.SplitName(d.Id()) + + if err = clientSet.FormationV1Beta1().Formations(env).Delete(ctx, name, metav1.DeleteOptions{}); err != nil { + switch { + case errors.IsNotFound(err): + // We will consider this a successful delete. + default: + return diag.FromErr(err) + } + } + + d.SetId("") + return nil +} diff --git a/ec/formation/resource_formation_test.go b/ec/formation/resource_formation_test.go new file mode 100644 index 0000000..48adc07 --- /dev/null +++ b/ec/formation/resource_formation_test.go @@ -0,0 +1,157 @@ +package formation_test + +import ( + "context" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/nitrado/terraform-provider-ec/ec/provider/providertest" + metav1 "gitlab.com/nitrado/b2b/ec/apicore/apis/meta/v1" + "gitlab.com/nitrado/b2b/ec/core/pkg/apiclient/clientset" +) + +func TestResourceFormations(t *testing.T) { + name := "my-formation" + env := "dflt" + pf, cs := providertest.SetupProviderFactories(t) + + resource.Test(t, resource.TestCase{ + IsUnitTest: true, + ProviderFactories: pf, + CheckDestroy: testCheckFormationsDestroy(cs), + Steps: []resource.TestStep{ + { + Config: testResourceFormationsConfigBasic(env, name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.#", "1"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.description", "My Formation"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.vessels.0.region", "eu"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + ), + }, + { + Config: testResourceFormationsConfigBasicWithEnv(env, name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_formation.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.#", "1"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.description", "My Formation"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.vessels.0.region", "eu"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.env.#", "2"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.env.0.name", "foo"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.env.0.value", "bar"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.env.1.name", "baz"), + resource.TestCheckResourceAttr("ec_formation_formation.test", "spec.0.template.0.spec.0.containers.0.env.1.value_from.0.config_file_key_ref.0.name", "bat"), + ), + }, + { + ResourceName: "ec_formation_formation.test", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testResourceFormationsConfigBasic(env, name string) string { + return fmt.Sprintf(`resource "ec_formation_formation" "test" { + metadata { + name = "%s" + environment = "%s" + } + spec { + description = "My Formation" + vessels { + name = "eu-vessel" + region = "eu" + } + template { + metadata { + labels = { + "foo" = "bar" + } + } + spec { + containers { + name = "my-ctr" + branch = "prod" + image = "test-xyz" + } + } + } + } +}`, name, env) +} + +func testResourceFormationsConfigBasicWithEnv(env, name string) string { + return fmt.Sprintf(`resource "ec_formation_formation" "test" { + metadata { + name = "%s" + environment = "%s" + } + spec { + description = "My Formation" + vessels { + name = "eu-vessel" + region = "eu" + } + template { + metadata { + labels = { + "foo" = "bar" + } + } + spec { + containers { + name = "my-ctr" + branch = "prod" + image = "test-xyz" + env { + name = "foo" + value = "bar" + } + env { + name = "baz" + value_from { + config_file_key_ref { + name = "bat" + } + } + } + } + } + } + } +}`, name, env) +} + +func testCheckFormationsDestroy(cs clientset.Interface) func(s *terraform.State) error { + return func(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "ec_formation_formation" { + continue + } + + env, name, _ := strings.Cut(rs.Primary.ID, "/") + resp, err := cs.FormationV1Beta1().Formations(env).Get(context.Background(), name, metav1.GetOptions{}) + if err == nil { + if resp.Name == rs.Primary.ID { + return fmt.Errorf("formation still exists: %s", rs.Primary.ID) + } + } + } + return nil + } +} diff --git a/ec/formation/resource_vessel.go b/ec/formation/resource_vessel.go new file mode 100644 index 0000000..d336903 --- /dev/null +++ b/ec/formation/resource_vessel.go @@ -0,0 +1,129 @@ +package formation + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/nitrado/terraform-provider-ec/ec" + "github.com/nitrado/terraform-provider-ec/pkg/resource" + "gitlab.com/nitrado/b2b/ec/apicore/api/errors" + metav1 "gitlab.com/nitrado/b2b/ec/apicore/apis/meta/v1" + formationv1beta1 "gitlab.com/nitrado/b2b/ec/core/pkg/api/formation/v1beta1" +) + +// ResourceVessel returns the resource for a Vessel. +func ResourceVessel() *schema.Resource { + return &schema.Resource{ + Description: "A Vessel is the specification of a game server to be deployed on a specific Region.", + ReadContext: resourceVesselRead, + CreateContext: resourceVesselCreate, + UpdateContext: resourceVesselUpdate, + DeleteContext: resourceVesselDelete, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Schema: vesselSchema(), + } +} + +func resourceVesselRead(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + env, name := ec.SplitName(d.Id()) + + obj, err := clientSet.FormationV1Beta1().Vessels(env).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + switch { + case errors.IsNotFound(err): + d.SetId("") + return nil + default: + return diag.FromErr(err) + } + } + + data, err := ec.Converter().Flatten(obj, vesselSchema()) + if err != nil { + return diag.FromErr(err) + } + + if err = resource.SetData(d, data); err != nil { + return diag.FromErr(err) + } + return nil +} + +func resourceVesselCreate(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + obj := &formationv1beta1.Vessel{} + if err = ec.Converter().Expand(d.Get("metadata").([]any), &obj.ObjectMeta); err != nil { + return diag.FromErr(err) + } + if err = ec.Converter().Expand(d.Get("spec").([]any), &obj.Spec); err != nil { + return diag.FromErr(err) + } + + out, err := clientSet.FormationV1Beta1().Vessels(obj.Environment).Create(ctx, obj, metav1.CreateOptions{}) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(ec.ScopedName(out.Environment, out.Name)) + return resourceVesselRead(ctx, d, m) +} + +func resourceVesselUpdate(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + obj := &formationv1beta1.Vessel{} + if err = ec.Converter().Expand(d.Get("metadata").([]any), &obj.ObjectMeta); err != nil { + return diag.FromErr(err) + } + if err = ec.Converter().Expand(d.Get("spec").([]any), &obj.Spec); err != nil { + return diag.FromErr(err) + } + + out, err := clientSet.FormationV1Beta1().Vessels(obj.Environment).Update(ctx, obj, metav1.UpdateOptions{}) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(ec.ScopedName(out.Environment, out.Name)) + return resourceVesselRead(ctx, d, m) +} + +func resourceVesselDelete(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics { + inst, _ := d.Get("instance").(string) + clientSet, err := ec.ResolveClientSet(m, inst) + if err != nil { + return diag.FromErr(err) + } + + env, name := ec.SplitName(d.Id()) + + if err = clientSet.FormationV1Beta1().Vessels(env).Delete(ctx, name, metav1.DeleteOptions{}); err != nil { + switch { + case errors.IsNotFound(err): + // We will consider this a successful delete. + default: + return diag.FromErr(err) + } + } + + d.SetId("") + return nil +} diff --git a/ec/formation/resource_vessel_test.go b/ec/formation/resource_vessel_test.go new file mode 100644 index 0000000..42aad0d --- /dev/null +++ b/ec/formation/resource_vessel_test.go @@ -0,0 +1,151 @@ +package formation_test + +import ( + "context" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/nitrado/terraform-provider-ec/ec/provider/providertest" + metav1 "gitlab.com/nitrado/b2b/ec/apicore/apis/meta/v1" + "gitlab.com/nitrado/b2b/ec/core/pkg/apiclient/clientset" +) + +func TestResourceVessels(t *testing.T) { + name := "my-vessel" + env := "dflt" + pf, cs := providertest.SetupProviderFactories(t) + + resource.Test(t, resource.TestCase{ + IsUnitTest: true, + ProviderFactories: pf, + CheckDestroy: testCheckVesselsDestroy(cs), + Steps: []resource.TestStep{ + { + Config: testResourceVesselsConfigBasic(env, name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ec_formation_vessel.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.#", "1"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.description", "My Vessel"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.region", "eu"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + ), + }, + { + Config: testResourceVesselsConfigBasicWithEnv(env, name), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ec_formation_vessel.test", "metadata.0.name", name), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "metadata.0.environment", env), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.#", "1"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.description", "My Vessel"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.region", "eu"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.metadata.0.labels.foo", "bar"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.name", "my-ctr"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.branch", "prod"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.image", "test-xyz"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.env.#", "2"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.env.0.name", "foo"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.env.0.value", "bar"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.env.1.name", "baz"), + resource.TestCheckResourceAttr("ec_formation_vessel.test", "spec.0.template.0.spec.0.containers.0.env.1.value_from.0.config_file_key_ref.0.name", "bat"), + ), + }, + { + ResourceName: "ec_formation_vessel.test", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testResourceVesselsConfigBasic(env, name string) string { + return fmt.Sprintf(`resource "ec_formation_vessel" "test" { + metadata { + name = "%s" + environment = "%s" + } + spec { + description = "My Vessel" + region = "eu" + template { + metadata { + labels = { + "foo" = "bar" + } + } + spec { + containers { + name = "my-ctr" + branch = "prod" + image = "test-xyz" + } + } + } + } +}`, name, env) +} + +func testResourceVesselsConfigBasicWithEnv(env, name string) string { + return fmt.Sprintf(`resource "ec_formation_vessel" "test" { + metadata { + name = "%s" + environment = "%s" + } + spec { + description = "My Vessel" + region = "eu" + template { + metadata { + labels = { + "foo" = "bar" + } + } + spec { + containers { + name = "my-ctr" + branch = "prod" + image = "test-xyz" + env { + name = "foo" + value = "bar" + } + env { + name = "baz" + value_from { + config_file_key_ref { + name = "bat" + } + } + } + } + } + } + } +}`, name, env) +} + +func testCheckVesselsDestroy(cs clientset.Interface) func(s *terraform.State) error { + return func(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "ec_formation_vessel" { + continue + } + + env, name, _ := strings.Cut(rs.Primary.ID, "/") + resp, err := cs.FormationV1Beta1().Vessels(env).Get(context.Background(), name, metav1.GetOptions{}) + if err == nil { + if resp.Name == rs.Primary.ID { + return fmt.Errorf("vessel still exists: %s", rs.Primary.ID) + } + } + } + return nil + } +} diff --git a/ec/formation/schema_env.go b/ec/formation/schema_env.go new file mode 100644 index 0000000..a9e3062 --- /dev/null +++ b/ec/formation/schema_env.go @@ -0,0 +1,63 @@ +package formation + +// Code generated by schema-gen. DO NOT EDIT. + +import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + +func envSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Description: "Name is the name of the environment variable.", + Required: true, + }, + "value": { + Type: schema.TypeString, + Description: "Value is the value of the environment variable.", + Optional: true, + }, + "value_from": { + Type: schema.TypeList, + Description: "ValueFrom is the source for the environment variable's value.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "config_file_key_ref": { + Type: schema.TypeList, + Description: "ConfigFileKeyRef select the configuration file.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Description: "Name is the name of the configuration file.", + Required: true, + }, + }, + }, + }, + "field_ref": { + Type: schema.TypeList, + Description: "FieldRef selects the field of the pod. Supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, metadata.armadaName, metadata.regionName, metadata.regionTypeName, metadata.siteName, metadata.imageBranch, metadata.imageName, metadata.imageTag, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_version": { + Type: schema.TypeString, + Optional: true, + }, + "field_path": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + } +} diff --git a/ec/formation/schema_formation.go b/ec/formation/schema_formation.go new file mode 100644 index 0000000..c4bfdfa --- /dev/null +++ b/ec/formation/schema_formation.go @@ -0,0 +1,590 @@ +package formation + +// Code generated by schema-gen. DO NOT EDIT. + +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/nitrado/terraform-provider-ec/ec/meta" +) + +func formationSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "instance": { + Type: schema.TypeString, + Description: "Name is an instance name configured in the provider.", + Optional: true, + }, + "metadata": { + Type: schema.TypeList, + Description: "Standard object's metadata.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{Schema: meta.Schema()}, + }, + "spec": { + Type: schema.TypeList, + Description: "Spec defines the desired vessels in this formation.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Description: "Description is the optional description of the formation.", + Optional: true, + }, + "template": { + Type: schema.TypeList, + Description: "Template describes the game server that is created.", + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "metadata": { + Type: schema.TypeList, + Description: "Standard object's metadata.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{Schema: meta.Schema()}, + }, + "spec": { + Type: schema.TypeList, + Description: "Spec defines the desired game server.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "containers": { + Type: schema.TypeList, + Description: "Containers is a list of container belonging to the game server.", + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "args": { + Type: schema.TypeList, + Description: "Args are arguments to the entrypoint.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "branch": { + Type: schema.TypeString, + Description: "Branch is the name of the image branch.", + Required: true, + }, + "command": { + Type: schema.TypeList, + Description: "Command is the entrypoint array. This is not executed within a shell.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "config_files": { + Type: schema.TypeList, + Description: "ConfigFiles is a list of configuration files to mount into the containers filesystem.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mount_path": { + Type: schema.TypeString, + Description: "MountPath is the path to mount the configuration file on.", + Required: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the configuration file.", + Required: true, + }, + }, + }, + }, + "env": { + Type: schema.TypeList, + Description: "Env is a list of environment variables to set in the container.", + Optional: true, + Elem: &schema.Resource{Schema: envSchema()}, + }, + "image": { + Type: schema.TypeString, + Description: "Image is a reference to the containerv1.Image to deploy in this container.", + Required: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the container.", + Required: true, + }, + "ports": { + Type: schema.TypeList, + Description: "Ports are the ports to expose from the container.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "container_port": { + Type: schema.TypeInt, + Description: "ContainerPort is the port that is being opened on the specified container's process.", + Optional: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the port.", + Required: true, + }, + "policy": { + Type: schema.TypeString, + Description: "Policy defines the policy for how the HostPort is populated.", + Required: true, + }, + "protocol": { + Type: schema.TypeString, + Description: "Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options.", + Optional: true, + }, + }, + }, + }, + "resources": { + Type: schema.TypeList, + Description: "Resources are the compute resources required by the container.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "claims": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "limits": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "requests": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "security_context": { + Type: schema.TypeList, + Description: "SecurityContext defines the security options the container should be run with.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "allow_privilege_escalation": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "capabilities": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "add": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "drop": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "privileged": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "proc_mount": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "read_only_root_filesystem": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "run_as_group": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "run_as_non_root": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "run_as_user": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "se_linux_options": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "level": { + Type: schema.TypeString, + Optional: true, + }, + "role": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + }, + "user": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "seccomp_profile": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "localhost_profile": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "type": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "windows_options": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gmsa_credential_spec": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "gmsa_credential_spec_name": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "host_process": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "run_as_user_name": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "volume_mounts": { + Type: schema.TypeList, + Description: "VolumeMounts are the volumes to mount into the container's filesystem.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mount_path": { + Type: schema.TypeString, + Optional: true, + }, + "mount_propagation": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "name": { + Type: schema.TypeString, + Optional: true, + }, + "read_only": { + Type: schema.TypeBool, + Optional: true, + }, + "sub_path": { + Type: schema.TypeString, + Optional: true, + }, + "sub_path_expr": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "health": { + Type: schema.TypeList, + Description: "Health is the health checking configuration for Agones game servers.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disabled": { + Type: schema.TypeBool, + Optional: true, + }, + "failure_threshold": { + Type: schema.TypeInt, + Optional: true, + }, + "initial_delay_seconds": { + Type: schema.TypeInt, + Optional: true, + }, + "period_seconds": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "volumes": { + Type: schema.TypeList, + Description: "Volumes are pod volumes.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "medium": { + Type: schema.TypeString, + Description: "Medium is the storage medium type.", + Optional: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the volume mount.", + Required: true, + }, + "size_limit": { + Type: schema.TypeList, + Description: "SizeLimit is the maximum size of the volume.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Description: "SizeLimit is the maximum size of the volume.", + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "vessels": { + Type: schema.TypeList, + Description: "Vessels is a list of vessels belonging to the formation.", + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Description: "Description is the optional description of the vessel.", + Optional: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the vessel.", + Required: true, + }, + "override": { + Type: schema.TypeList, + Description: "Override describes how the game server is configured for this vessel.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "containers": { + Type: schema.TypeList, + Description: "Containers is a list of container override values.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "args": { + Type: schema.TypeList, + Description: "Args are arguments to the entrypoint.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "command": { + Type: schema.TypeList, + Description: "Command is the entrypoint array. This is not executed within a shell.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "env": { + Type: schema.TypeList, + Description: "Env is a list of environment variables to set on containers.", + Optional: true, + Elem: &schema.Resource{Schema: envSchema()}, + }, + }, + }, + }, + "labels": { + Type: schema.TypeMap, + Description: "Labels is a map of keys and values that can be used to organize and categorize objects.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "region": { + Type: schema.TypeString, + Description: "Region defines the region the vessel is deployed to.", + Required: true, + }, + }, + }, + }, + }, + }, + }, + } +} diff --git a/ec/formation/schema_vessel.go b/ec/formation/schema_vessel.go new file mode 100644 index 0000000..df2341f --- /dev/null +++ b/ec/formation/schema_vessel.go @@ -0,0 +1,528 @@ +package formation + +// Code generated by schema-gen. DO NOT EDIT. + +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/nitrado/terraform-provider-ec/ec/meta" +) + +func vesselSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "instance": { + Type: schema.TypeString, + Description: "Name is an instance name configured in the provider.", + Optional: true, + }, + "metadata": { + Type: schema.TypeList, + Description: "Standard object's metadata.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{Schema: meta.Schema()}, + }, + "spec": { + Type: schema.TypeList, + Description: "Spec defines the desired vessel.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Description: "Description is the optional description of the vessel.", + Optional: true, + }, + "region": { + Type: schema.TypeString, + Description: "Region defines the region the vessel is deployed to.", + Required: true, + }, + "template": { + Type: schema.TypeList, + Description: "Template describes the game server that is created.", + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "metadata": { + Type: schema.TypeList, + Description: "Standard object's metadata.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{Schema: meta.Schema()}, + }, + "spec": { + Type: schema.TypeList, + Description: "Spec defines the desired game server.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "containers": { + Type: schema.TypeList, + Description: "Containers is a list of container belonging to the game server.", + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "args": { + Type: schema.TypeList, + Description: "Args are arguments to the entrypoint.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "branch": { + Type: schema.TypeString, + Description: "Branch is the name of the image branch.", + Required: true, + }, + "command": { + Type: schema.TypeList, + Description: "Command is the entrypoint array. This is not executed within a shell.", + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "config_files": { + Type: schema.TypeList, + Description: "ConfigFiles is a list of configuration files to mount into the containers filesystem.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mount_path": { + Type: schema.TypeString, + Description: "MountPath is the path to mount the configuration file on.", + Required: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the configuration file.", + Required: true, + }, + }, + }, + }, + "env": { + Type: schema.TypeList, + Description: "Env is a list of environment variables to set in the container.", + Optional: true, + Elem: &schema.Resource{Schema: envSchema()}, + }, + "image": { + Type: schema.TypeString, + Description: "Image is a reference to the containerv1.Image to deploy in this container.", + Required: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the container.", + Required: true, + }, + "ports": { + Type: schema.TypeList, + Description: "Ports are the ports to expose from the container.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "container_port": { + Type: schema.TypeInt, + Description: "ContainerPort is the port that is being opened on the specified container's process.", + Optional: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the port.", + Required: true, + }, + "policy": { + Type: schema.TypeString, + Description: "Policy defines the policy for how the HostPort is populated.", + Required: true, + }, + "protocol": { + Type: schema.TypeString, + Description: "Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options.", + Optional: true, + }, + }, + }, + }, + "resources": { + Type: schema.TypeList, + Description: "Resources are the compute resources required by the container.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "claims": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "limits": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "requests": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "security_context": { + Type: schema.TypeList, + Description: "SecurityContext defines the security options the container should be run with.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "allow_privilege_escalation": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "capabilities": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "add": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "drop": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "privileged": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "proc_mount": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "read_only_root_filesystem": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "run_as_group": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "run_as_non_root": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "run_as_user": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "se_linux_options": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "level": { + Type: schema.TypeString, + Optional: true, + }, + "role": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + }, + "user": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "seccomp_profile": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "localhost_profile": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "type": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "windows_options": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gmsa_credential_spec": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "gmsa_credential_spec_name": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "host_process": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, + "run_as_user_name": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "volume_mounts": { + Type: schema.TypeList, + Description: "VolumeMounts are the volumes to mount into the container's filesystem.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mount_path": { + Type: schema.TypeString, + Optional: true, + }, + "mount_propagation": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "name": { + Type: schema.TypeString, + Optional: true, + }, + "read_only": { + Type: schema.TypeBool, + Optional: true, + }, + "sub_path": { + Type: schema.TypeString, + Optional: true, + }, + "sub_path_expr": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "health": { + Type: schema.TypeList, + Description: "Health is the health checking configuration for Agones game servers.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disabled": { + Type: schema.TypeBool, + Optional: true, + }, + "failure_threshold": { + Type: schema.TypeInt, + Optional: true, + }, + "initial_delay_seconds": { + Type: schema.TypeInt, + Optional: true, + }, + "period_seconds": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "volumes": { + Type: schema.TypeList, + Description: "Volumes are pod volumes.", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "medium": { + Type: schema.TypeString, + Description: "Medium is the storage medium type.", + Optional: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name is the name of the volume mount.", + Required: true, + }, + "size_limit": { + Type: schema.TypeList, + Description: "SizeLimit is the maximum size of the volume.", + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Description: "SizeLimit is the maximum size of the volume.", + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } +} diff --git a/ec/provider/provider.go b/ec/provider/provider.go index 410adbc..0bcc101 100644 --- a/ec/provider/provider.go +++ b/ec/provider/provider.go @@ -13,6 +13,7 @@ import ( "github.com/nitrado/terraform-provider-ec/ec/armada" "github.com/nitrado/terraform-provider-ec/ec/container" "github.com/nitrado/terraform-provider-ec/ec/core" + "github.com/nitrado/terraform-provider-ec/ec/formation" "gitlab.com/nitrado/b2b/ec/core/pkg/apiclient/clientset" "gitlab.com/nitrado/b2b/ec/core/pkg/apiclient/rest" "golang.org/x/oauth2" @@ -105,34 +106,42 @@ func Provider() *schema.Provider { }, }, DataSourcesMap: map[string]*schema.Resource{ - "ec_armada_armada": armada.DataSourceArmada(), - "ec_armada_armada_v1": armada.DataSourceArmada(), - "ec_armada_armadaset": armada.DataSourceArmadaSet(), - "ec_armada_armadaset_v1": armada.DataSourceArmadaSet(), - "ec_container_branch": container.DataSourceBranch(), - "ec_container_branch_v1": container.DataSourceBranch(), - "ec_container_image": container.DataSourceImage(), - "ec_container_image_v1": container.DataSourceImage(), - "ec_core_environment": core.DataSourceEnvironment(), - "ec_core_environment_v1": core.DataSourceEnvironment(), - "ec_core_site": core.DataSourceSite(), - "ec_core_site_v1": core.DataSourceSite(), - "ec_core_region": core.DataSourceRegion(), - "ec_core_region_v1": core.DataSourceRegion(), + "ec_armada_armada": armada.DataSourceArmada(), + "ec_armada_armada_v1": armada.DataSourceArmada(), + "ec_armada_armadaset": armada.DataSourceArmadaSet(), + "ec_armada_armadaset_v1": armada.DataSourceArmadaSet(), + "ec_container_branch": container.DataSourceBranch(), + "ec_container_branch_v1": container.DataSourceBranch(), + "ec_container_image": container.DataSourceImage(), + "ec_container_image_v1": container.DataSourceImage(), + "ec_core_environment": core.DataSourceEnvironment(), + "ec_core_environment_v1": core.DataSourceEnvironment(), + "ec_core_site": core.DataSourceSite(), + "ec_core_site_v1": core.DataSourceSite(), + "ec_core_region": core.DataSourceRegion(), + "ec_core_region_v1": core.DataSourceRegion(), + "ec_formation_vessel": formation.DataSourceVessel(), + "ec_formation_vessel_v1beta1": formation.DataSourceVessel(), + "ec_formation_formation": formation.DataSourceFormation(), + "ec_formation_formation_v1beta1": formation.DataSourceFormation(), }, ResourcesMap: map[string]*schema.Resource{ - "ec_armada_armada": armada.ResourceArmada(), - "ec_armada_armada_v1": armada.ResourceArmada(), - "ec_armada_armadaset": armada.ResourceArmadaSet(), - "ec_armada_armadaset_v1": armada.ResourceArmadaSet(), - "ec_container_branch": container.ResourceBranch(), - "ec_container_branch_v1": container.ResourceBranch(), - "ec_core_environment": core.ResourceEnvironment(), - "ec_core_environment_v1": core.ResourceEnvironment(), - "ec_core_site": core.ResourceSite(), - "ec_core_site_v1": core.ResourceSite(), - "ec_core_region": core.ResourceRegion(), - "ec_core_region_v1": core.ResourceRegion(), + "ec_armada_armada": armada.ResourceArmada(), + "ec_armada_armada_v1": armada.ResourceArmada(), + "ec_armada_armadaset": armada.ResourceArmadaSet(), + "ec_armada_armadaset_v1": armada.ResourceArmadaSet(), + "ec_container_branch": container.ResourceBranch(), + "ec_container_branch_v1": container.ResourceBranch(), + "ec_core_environment": core.ResourceEnvironment(), + "ec_core_environment_v1": core.ResourceEnvironment(), + "ec_core_site": core.ResourceSite(), + "ec_core_site_v1": core.ResourceSite(), + "ec_core_region": core.ResourceRegion(), + "ec_core_region_v1": core.ResourceRegion(), + "ec_formation_vessel": formation.ResourceVessel(), + "ec_formation_vessel_v1beta1": formation.ResourceVessel(), + "ec_formation_formation": formation.ResourceFormation(), + "ec_formation_formation_v1beta1": formation.ResourceFormation(), }, } diff --git a/go.mod b/go.mod index 4241ab3..b41c139 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/nitrado/tfconv v1.0.3 github.com/stretchr/testify v1.9.0 gitlab.com/nitrado/b2b/ec/apicore v1.1.1-0.20240509125453-e14a30436c3f - gitlab.com/nitrado/b2b/ec/core v0.9.1-0.20240620093923-a10a29e03231 + gitlab.com/nitrado/b2b/ec/core v0.10.1 golang.org/x/oauth2 v0.20.0 k8s.io/apimachinery v0.29.5 ) diff --git a/go.sum b/go.sum index a784217..85071de 100644 --- a/go.sum +++ b/go.sum @@ -426,8 +426,8 @@ github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6 github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= gitlab.com/nitrado/b2b/ec/apicore v1.1.1-0.20240509125453-e14a30436c3f h1:efEb7AvFcqw86wWKPeVSnU1M1j5nxwpNBk96gqCXlUc= gitlab.com/nitrado/b2b/ec/apicore v1.1.1-0.20240509125453-e14a30436c3f/go.mod h1:uz5fRxpu71hJ/8LIrqsVB6bIdPAHWI1v0fNt7EjWCE0= -gitlab.com/nitrado/b2b/ec/core v0.9.1-0.20240620093923-a10a29e03231 h1:i2HYQg3HlTo5s43UX6Ktye+dyvZarkYG0jla5ih4YPs= -gitlab.com/nitrado/b2b/ec/core v0.9.1-0.20240620093923-a10a29e03231/go.mod h1:x+U+vEYMeSAZW0X7Da0ttOZpoJi2JyFhDyVFEinufqc= +gitlab.com/nitrado/b2b/ec/core v0.10.1 h1:CcWuRl/hpdL3kklIoydkzOoU+h5h1JXuuuSaCS4su8g= +gitlab.com/nitrado/b2b/ec/core v0.10.1/go.mod h1:cA3RJYl+jjIOs+FLI/BmKOJnQcn6uN/AU1zHWlbAISo= go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= diff --git a/internal/cmd/schema-gen/main.go b/internal/cmd/schema-gen/main.go index 439bca4..99191b6 100644 --- a/internal/cmd/schema-gen/main.go +++ b/internal/cmd/schema-gen/main.go @@ -8,6 +8,7 @@ import ( armadav1 "gitlab.com/nitrado/b2b/ec/core/pkg/api/armada/v1" containerv1 "gitlab.com/nitrado/b2b/ec/core/pkg/api/container/v1" corev1 "gitlab.com/nitrado/b2b/ec/core/pkg/api/core/v1" + formationv1beta1 "gitlab.com/nitrado/b2b/ec/core/pkg/api/formation/v1beta1" ) type objInfo struct { @@ -72,6 +73,24 @@ var objs = []objInfo{ Filename: "ec/core/schema_site.go", FuncName: "siteSchema", }, + { + Pkg: "formation", + Obj: corev1.EnvVar{}, + Filename: "ec/formation/schema_env.go", + FuncName: "envSchema", + }, + { + Pkg: "formation", + Obj: &formationv1beta1.Formation{}, + Filename: "ec/formation/schema_formation.go", + FuncName: "formationSchema", + }, + { + Pkg: "formation", + Obj: &formationv1beta1.Vessel{}, + Filename: "ec/formation/schema_vessel.go", + FuncName: "vesselSchema", + }, } func main() {