GithubHelp home page GithubHelp logo

terraform-provider-octopusdeploy's Introduction

[DEPRECIATED] terraform-provider-octopusdeploy

Good news!

The team at Octopus Deploy have taken notice of this project πŸŽ‰.

We have both decided the best way forward for the project is for the team at Octopus Deploy to take over the reins and continue the development and support.

This means that Octopus Deploy will be getting an official Terraform provider 😍.

It was never my intention to spend a lot of time looking after this project, so I am very excited that the team reached out and offered assistance.

The project has been forked at https://github.com/OctopusDeploy/terraform-provider-octopusdeploy.

Please head over there to contribute and file bug reports!

Happy Deploying!

Matthew Hodgkins

terraform-provider-octopusdeploy's People

Contributors

droyad avatar matthodge avatar mhenderson-so avatar pawelpabich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

terraform-provider-octopusdeploy's Issues

data source "octopusdeploy_project": cannot get endpoint /api/projects?skip=120&take=30 from server

After downloading the plugin and putting it in my terraform directory. I used the main.tf from #5 and I can run a terraform init but when I plan it gives me this issue.

$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.octopusdeploy_project.banana: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

* data.octopusdeploy_project.banana: 1 error(s) occurred:

* data.octopusdeploy_project.banana: data.octopusdeploy_project.banana: error reading project name bananas: cannot get endpoint /api/projects?skip=120&take=30 from server. failure from http client json: cannot unmarshal string into Go struct field ActionTemplateParameter.DefaultValue of type map[string]octopusdeploy.PropertyValue

I hit the endpoint directly and it works.

$ curl -X GET 'https://octo.domain.com/api/projects?skip=120&take=30' -H "X-Octopus-ApiKey: $OCTOPUS_CLI_API_KEY"
{
  "ItemType": "Project",
  "TotalResults": 440,
  "ItemsPerPage": 30,
  "NumberOfPages": 15,
  "LastPageNumber": 14,
  "Items": [
    ...
  ]
}

Is this a bug? If I can get a go IDE and debugger going, I'd like to step through this to see why it's having this issue.

Debt Wall

A dumping ground for improvements as I leave technical debt everywhere πŸ’© :

  • Configuration Transforms has an additional transforms filed which needs to be added to the provider

  • step_start_trigger should be a bool

  • skip_machine_behavior should be a bool and the property name changed, as there is only two options: SkipUnavailableMachines or None

  • There should be two more deployment step blocks inside a project, IIS Virtual Directory and IIS Web Application. The struct for these values are in this gist

  • application_pool_identity is missing a SpecificUser option which is blocked by to MattHodge/go-octopusdeploy#8

  • Deployment step ordering is currently not working correctly

Sensitive variable support

While we can add support to Octopus for sensitive variables (see https://octopusdeploy.uservoice.com/forums/170787-general/suggestions/35616472-provide-a-hash-of-sensitive-variables-so-we-can-de), it would meant that users on older versions can't use this provider with sensitive variables unless we have some fallback.

The other providers (eg Azure) I've used take the approach of storing the value in the state and only updating if the new value is different from the state, ignoring what the actual value is due to it not being retrievable.

Those other providers unfortunately store the secret in plain text in the state :(.

Azure machine target communication options missing

Heya,

First off I just want to say that this provider looks amazing and I think will solve a lot of problems with managing octopus resources in the future.

In my case, I'm looking to manage some AzureWebApp machine targets but unfortunately that's not possible as the current state of this provider doesn't have the ability to pass through the account and web app name as part of the communication method.

The resource arguments for machine targets might need a bit of a refactor as there are different required sets of communication options for the different targets. I think it could look something along these lines:

For a tentacle

endpoint {
  communicationstyle = "TentaclePassive"
  tentacle_config {
    thumbprint         = "81D0FF8B76FC"
    uri                = "https://finance-web-01:10933"
  }
}

For an AzureWebApp

endpoint {
  communicationstyle = "AzureWebApp"
  azure_web_app_config {
    account         = "SomeAzureAccount"
    web_app        = "web-app-reference"
    web_app_slot = "optional-slot"
  }
}

(I'm not sure how the api exposes the account/webapp settings, might need to be reference ids or something)

etc.

Request: Add Importers

As a terraform-provider-octopusdeploy user, I would like to Import existing Octopus Deploy resource state so we can manage OD configuration that was set previously outside of Terraform. Environment and Variable are all we currently need Import support for.

Improve Documentation

  • Move all documentation into the /docs/provider/ folder
  • Make sure all documentation matches "Terraform standards"
  • Add to contributing guide that documentation must conform to these standards

Cannot get endpoints from server

Hi,

I'm testing out the provider by setting up some variables and getting and error when running terraform plan, init completes successfully,

Error: Error refreshing state: 2 error(s) occurred:

* data.octopusdeploy_environment.octoterratest: 1 error(s) occurred:

* data.octopusdeploy_environment.octoterratest: data.octopusdeploy_environment.octoterratest: error reading environment with name OctoTerraTest: cannot get endpoint environments from server. failure from http client invalid character '<' looking for beginning of value
* data.octopusdeploy_project.octoterra: 1 error(s) occurred:

* data.octopusdeploy_project.octoterra: data.octopusdeploy_project.octoterra: error reading project name OctoTerra: cannot get endpoint projects from server. failure from http client invalid character '<' looking for beginning of value

I can query the project via the API ok. Running Octopus 2018.10.1

My config:
00-config.tf

terraform {
  backend "local" {
    path = "state/terraform.tfstate"
  }
}
provider "octopusdeploy" {
  address = "http://octopus.local"
  apikey  = "${file("/mnt/c/Temp/ocotpus-api-key")}"
}

05-main.tf

data "octopusdeploy_project" "octoterra" {
    name = "OctoTerra"
}
 data "octopusdeploy_environment" "octoterratest" {
     name = "OctoTerraTest"
 }

 resource "octopusdeploy_variable" "connection_string" {
  project_id = "${data.octopusdeploy_project.octoterra.id}"
  name       = "SomeConnectionString"
  type       = "String"
  value      = "Server=someSQLServer;Database=someDatabase;Trusted_Connection=True;"

  scope {
    environments = ["${data.octopusdeploy_environment.octoterratest.id}"]
  }
 }

Thanks

Implement Better Versioning / Release / Changelog

To make sure the provider is more stable, the versioning and release process needs to be refined.

  • Determine when is a good time to start using Semver
  • Update AppVeyor to not create a GitHub release on each build
  • Work out an automated way to handle the change log, perhaps commitizen or clog-cli

Scale support for Deployment Step Templates

There are a great many official deployment step templates, as seen here.
image

The provider currently has support for the main ones (like IIS deployments) through a named map block, which doesn't seem like it would scale well. Does creating either of the following sound logical enough?

  • An octopusdeploy_deployment_step resource
  • An octopusdeploy_deployment_step_template data provider that can generate the step (akin to the aws_iam_policy_document data provider that has a JSON document as an attribute)

Improvements to octopusdeploy_lifecycle resource

  • For tentacle_retention_policy, the unit should allow lowercase Days and Items. Currently, if you use lower case you get: octopusdeploy_lifecycle.foo: "days" is an invalid value for argument tentacle_retention_policy.0.unit. Must be one of []string{"Days", "Items"}

  • The octopusdeploy_lifecycle data source is currently not providing many attributes (only name, description, and use_guided_failure. More attributes should be supported.

Terraform Provider Development Program - Initial Review

Hey Matt,

My name is Chris, I'm a member of the Partner team @ HashiCorp.

I’ve taken a look at the provider here and would like to say great work so far! I do have feedback outlined below that I’d like to see addressed before we move on to the next steps. I’m opening this issues as a sort of checklist for tracking items and discussion.

  • The documentation for this provider will be published onto Terraform.io once released, which means the you docs/ directory should be moved into a new website/ directory that must contain a Ruby layout file that will act as the sidebar menu in the Terraform.io documentation for this provider. The TLS provider has a good example of this.

  • All of our Terraform Providers use a MPL2.0 license, can you update that from the MIT license you currently have?

  • The makefile must be consistent will all other provider GNUmakefile as it's used in a few different CI processes, you will just need to update the PKG_NAME on line 4 to octopusdeploy

  • Once the provider is released, there will be a Travis check run on each PR. You'll need to add this .travis.yaml file for that test.

  • There are four scripts that are required for the testing a deployment of the terraform provider, here's a good example of the scripts/

As well I want to include this list of Terraform provider code expectations/conventions that were define by the Terraform engineering team.

  • resource filename matches convention resource_providername_resourcename.go
  • data source filename matches convention data_source_providername_resourcename.go
  • we always let d.Set() to dereference pointers safely to avoid crashes, i.e. there's nothing like d.Set(*variable)
  • flatteners and expanders are in structures.go + tests in structures_test.go
  • any validation functions longer than a few lines are in validators.go + tests in validators_test.go
  • d.Set() is called in any C/R/U/D for all available fields unless they're Computed-only (i.e. there are no orphans)
  • all of d.Set(), d.Get(), d.GetOk(), d.GetChange() etc. use real field names (i.e. no typos)
  • d.Set() is always error-checked if it’s set, list or map
  • d.Set() is never error-checked if it's primitive data type (string, int, float, bool)
  • Resource uses either Read or Exists function to remove resource from state if it's gone
  • d.Partial() & d.SetPartial() are used any time there's more than 1 API call used to create or update a resource.
  • schema.ForceNew is used for any field that is not updatable
  • all field names are lowercase_underscore
  • where possible data source fields match resource (e.g. when referencing aws_instance user shouldn't need to change anything - just add data. prefix)
  • Constants are used if there are available in the upstream SDK (e.g. for status codes)
  • [INFO] log message at least 2 per each C/R/U/D - e.g. creating (input), created (output)
  • The provider code does not panic, always returns errors

If you have any question about the feedback let me know.

Best,
Chris

What is the roadmap to publish this provider to hashicorp?

main.tf

provider "octopusdeploy" {
  address = "https://octo.domain.com"
  apikey  = "API-XXXXXXXXXXXXXXXXXXXXXXXXXX"
}

data "octopusdeploy_project" "banana" {
    name = "bananas"
}
$ terraform init

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...

Provider "octopusdeploy" not available for installation.

A provider named "octopusdeploy" could not be found in the official repository.

This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.

In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
    terraform.d/plugins/darwin_amd64

Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".

I feel like I'm doing something silly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.