Skip to content

Commit

Permalink
Updated docs, dependencies, and nil checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jbristowe committed Dec 14, 2020
1 parent 2ded827 commit 7a65762
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
8 changes: 0 additions & 8 deletions docs/resources/project.md
Expand Up @@ -13,11 +13,9 @@ This resource manages projects in Octopus Deploy.

```terraform
resource "octopusdeploy_project" "example" {
allow_deployments_to_no_targets = false
auto_create_release = false
default_guided_failure_mode = "EnvironmentDefault"
default_to_skip_if_already_installed = false
deployment_process_id = "deploymentprocess-Projects-123"
description = "The development project."
discrete_channel_release = false
is_disabled = false
Expand All @@ -26,19 +24,13 @@ resource "octopusdeploy_project" "example" {
lifecycle_id = "Lifecycles-123"
name = "Development Project (OK to Delete)"
project_group_id = "ProjectGroups-123"
slug = "development-project"
tenanted_deployment_participation = "TenantedOrUntenanted"
variable_set_id = "variableset-Projects-123"
connectivity_policy {
allow_deployments_to_no_targets = false
exclude_unhealthy_targets = false
skip_machine_behavior = "SkipUnavailableMachines"
}
versioning_strategy {
template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"
}
}
```

Expand Down
8 changes: 0 additions & 8 deletions examples/resources/octopusdeploy_project/resource.tf
@@ -1,9 +1,7 @@
resource "octopusdeploy_project" "example" {
allow_deployments_to_no_targets = false
auto_create_release = false
default_guided_failure_mode = "EnvironmentDefault"
default_to_skip_if_already_installed = false
deployment_process_id = "deploymentprocess-Projects-123"
description = "The development project."
discrete_channel_release = false
is_disabled = false
Expand All @@ -12,17 +10,11 @@ resource "octopusdeploy_project" "example" {
lifecycle_id = "Lifecycles-123"
name = "Development Project (OK to Delete)"
project_group_id = "ProjectGroups-123"
slug = "development-project"
tenanted_deployment_participation = "TenantedOrUntenanted"
variable_set_id = "variableset-Projects-123"

connectivity_policy {
allow_deployments_to_no_targets = false
exclude_unhealthy_targets = false
skip_machine_behavior = "SkipUnavailableMachines"
}

versioning_strategy {
template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"
}
}
2 changes: 1 addition & 1 deletion go.mod
@@ -1,7 +1,7 @@
module github.com/OctopusDeploy/terraform-provider-octopusdeploy

require (
github.com/OctopusDeploy/go-octopusdeploy v1.7.3-0.20201211022823-921bafd0dd48
github.com/OctopusDeploy/go-octopusdeploy v1.7.3-0.20201214082559-4fdcca10bdb7
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.35.35 // indirect
Expand Down
4 changes: 4 additions & 0 deletions octopusdeploy/schema_deployment_action_package.go
Expand Up @@ -6,6 +6,10 @@ import (
)

func expandDeploymentActionPackage(deploymentActionPackage []interface{}) *octopusdeploy.DeploymentActionPackage {
if len(deploymentActionPackage) == 0 {
return nil
}

flattenedMap := deploymentActionPackage[0].(map[string]interface{})
return &octopusdeploy.DeploymentActionPackage{
DeploymentAction: flattenedMap["deployment_action"].(string),
Expand Down
6 changes: 5 additions & 1 deletion octopusdeploy/schema_release_creation_strategy.go
Expand Up @@ -6,11 +6,15 @@ import (
)

func expandReleaseCreationStrategy(releaseCreationStrategy []interface{}) *octopusdeploy.ReleaseCreationStrategy {
if len(releaseCreationStrategy) == 0 {
return nil
}

releaseCreationStrategyMap := releaseCreationStrategy[0].(map[string]interface{})
return &octopusdeploy.ReleaseCreationStrategy{
ChannelID: releaseCreationStrategyMap["channel_id"].(string),
ReleaseCreationPackage: expandDeploymentActionPackage(releaseCreationStrategyMap["release_creation_package"].([]interface{})),
ReleaseCreationPackageStepID: releaseCreationStrategyMap["release_creation_package_step_id"].(*string),
ReleaseCreationPackageStepID: releaseCreationStrategyMap["release_creation_package_step_id"].(string),
}
}

Expand Down

0 comments on commit 7a65762

Please sign in to comment.