Skip to content

Commit

Permalink
add container options to kubernetes resource (#622)
Browse files Browse the repository at this point in the history
* add container options to kubernetes resource

* update docs
  • Loading branch information
zentron committed Mar 28, 2024
1 parent 460fb08 commit 1e47a13
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--azure_cloud_service_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--azure_cloud_service_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--azure_service_fabric_cluster_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--azure_service_fabric_cluster_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/azure_web_app_deployment_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--azure_web_app_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--azure_web_app_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/cloud_region_deployment_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--cloud_region_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--cloud_region_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/deployment_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
2 changes: 2 additions & 0 deletions docs/data-sources/kubernetes_cluster_deployment_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Read-Only:
- `cluster_certificate_path` (String)
- `cluster_url` (String)
- `container` (List of Object) (see [below for nested schema](#nestedatt--kubernetes_cluster_deployment_targets--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `endpoint` (List of Object) (see [below for nested schema](#nestedatt--kubernetes_cluster_deployment_targets--endpoint))
- `environments` (List of String) A list of environment IDs associated with this resource.
Expand Down Expand Up @@ -152,6 +153,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--kubernetes_cluster_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--kubernetes_cluster_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--offline_package_drop_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--offline_package_drop_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/polling_tentacle_deployment_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--polling_tentacle_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--polling_tentacle_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/ssh_connection_deployment_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Read-Only:
- `communication_style` (String)
- `connection_endpoint` (String)
- `container` (List of Object) (see [below for nested schema](#nestedobjatt--ssh_connection_deployment_targets--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (List of Object) (see [below for nested schema](#nestedobjatt--ssh_connection_deployment_targets--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/azure_cloud_service_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/azure_web_app_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/cloud_region_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/kubernetes_cluster_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ resource "octopusdeploy_kubernetes_cluster_deployment_target" "k8s-target" {
- `cluster_certificate` (String)
- `cluster_certificate_path` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `endpoint` (Block List) (see [below for nested schema](#nestedblock--endpoint))
- `gcp_account_authentication` (Block List, Max: 1) (see [below for nested schema](#nestedblock--gcp_account_authentication))
Expand Down Expand Up @@ -151,6 +152,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/offline_package_drop_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/polling_tentacle_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/ssh_connection_deployment_target.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Optional:
- `cluster_url` (String)
- `connection_endpoint` (String)
- `container` (Block List) (see [below for nested schema](#nestedblock--endpoint--container))
- `container_options` (String)
- `default_worker_pool_id` (String)
- `destination` (Block List) (see [below for nested schema](#nestedblock--endpoint--destination))
- `dot_net_core_platform` (String)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/OctopusDeploy/terraform-provider-octopusdeploy
go 1.21

require (
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.40.0
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.40.3
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240314225537-8e0a92384cf9
github.com/google/uuid v1.6.0
github.com/gruntwork-io/terratest v0.41.11
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8=
github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.40.0 h1:0Q3Vfbuza9GysMjQk56WphA3Lu2Kw/A/T6suJ78RMec=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.40.0/go.mod h1:GZmFu6LmN8Yg0tEoZx3ytk9FnaH+84cWm7u5TdWZC6E=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.40.3 h1:Gi3tlcwFJPQe9mmdIV0NcScnHGvOcTFcoM67L+dx6gE=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.40.3/go.mod h1:GZmFu6LmN8Yg0tEoZx3ytk9FnaH+84cWm7u5TdWZC6E=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240314225537-8e0a92384cf9 h1:uaKQwRn5iIJnHRbRCRQrIRZKd0tqTfnOle6jSXk4wKs=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240314225537-8e0a92384cf9/go.mod h1:vE83OjlckiC+7quEvpR2KzQq3hvv9b+usqxaNNT4GCs=
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=
Expand Down
5 changes: 5 additions & 0 deletions octopusdeploy/schema_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func flattenEndpointResource(endpoint *machines.EndpointResource) []interface{}
"communication_style": endpoint.CommunicationStyle,
"connection_endpoint": endpoint.ConnectionEndpoint,
"container": flattenContainer(endpoint.Container),
"container_options": endpoint.ContainerOptions,
"default_worker_pool_id": endpoint.DefaultWorkerPoolID,
"destination": flattenOfflinePackageDropDestination(endpoint.Destination),
"dot_net_core_platform": endpoint.DotNetCorePlatform,
Expand Down Expand Up @@ -191,6 +192,10 @@ func getEndpointSchema() map[string]*schema.Schema {
Optional: true,
Type: schema.TypeList,
},
"container_options": {
Optional: true,
Type: schema.TypeString,
},
"default_worker_pool_id": {
Optional: true,
Type: schema.TypeString,
Expand Down
11 changes: 11 additions & 0 deletions octopusdeploy/schema_kubernetes_cluster_deployment_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func expandKubernetesClusterDeploymentTarget(d *schema.ResourceData) *machines.D
endpoint.Container = expandContainer(v)
}

if v, ok := d.GetOk("container_options"); ok {
endpoint.ContainerOptions = v.(string)
}

if v, ok := d.GetOk("default_worker_pool_id"); ok {
endpoint.DefaultWorkerPoolID = v.(string)
}
Expand Down Expand Up @@ -86,6 +90,7 @@ func flattenKubernetesClusterDeploymentTarget(deploymentTarget *machines.Deploym
flattenedDeploymentTarget["cluster_certificate"] = endpointResource.ClusterCertificate
flattenedDeploymentTarget["cluster_certificate_path"] = endpointResource.ClusterCertificatePath
flattenedDeploymentTarget["container"] = flattenContainer(endpointResource.Container)
flattenedDeploymentTarget["container_options"] = endpointResource.ContainerOptions
flattenedDeploymentTarget["default_worker_pool_id"] = endpointResource.DefaultWorkerPoolID
flattenedDeploymentTarget["namespace"] = endpointResource.Namespace
flattenedDeploymentTarget["proxy_id"] = endpointResource.ProxyID
Expand Down Expand Up @@ -212,6 +217,11 @@ func getKubernetesClusterDeploymentTargetSchema() map[string]*schema.Schema {
Type: schema.TypeList,
}

kubernetesClusterDeploymentTargetSchema["container_options"] = &schema.Schema{
Optional: true,
Type: schema.TypeString,
}

kubernetesClusterDeploymentTargetSchema["default_worker_pool_id"] = &schema.Schema{
Optional: true,
Type: schema.TypeString,
Expand Down Expand Up @@ -268,6 +278,7 @@ func setKubernetesClusterDeploymentTarget(ctx context.Context, d *schema.Resourc
d.Set("proxy_id", endpointResource.ProxyID)
d.Set("running_in_container", endpointResource.RunningInContainer)
d.Set("skip_tls_verification", endpointResource.SkipTLSVerification)
d.Set("container_options", endpointResource.ContainerOptions)

if endpointResource.ClusterURL != nil {
d.Set("cluster_url", endpointResource.ClusterURL.String())
Expand Down
1 change: 1 addition & 0 deletions terraform/47-k8stargetwithcert/machine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ resource octopusdeploy_kubernetes_cluster_deployment_target test_eks{
tenants = []
thumbprint = ""
uri = ""
container_options = "foobar"

endpoint {
communication_style = "Kubernetes"
Expand Down

0 comments on commit 1e47a13

Please sign in to comment.