sleuth-io/terraform-provider-sleuth

Sleuth not discovering CircleCI jobs or branches when building code_change_source with Terraform provider.

Opened this issue · 1 comments

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

0.3.5

Affected Resource(s)

Please list the resources as a list, for example:

  • code_change_source

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

when creating a code_change_source resource with a environment and build mappings to a main branch of a CircleCI project I would expect circleci jobs to be discoverable. It seems that they aren't in the same way that is seen in the Sleuth UI when integrating with CircleCI.

Actual Behavior

The resource is created. The github repo is found, but the branch stays unspecified and CircleCI cannot find the builds/jobs for the given project.

Steps to Reproduce

Applied code_change_source.
Went into the UI and edited the code_change_source manually as follows:

  • change the repo to a different repository
  • change back to the original repository/branch/circleci job and save
  • re-initialize the code_change_source at which point everything looks as expected

However, when I re-apply the terraform I am shown that the envrionment_slug is being changed in the following way:

sleuth_code_change_source.code_change_source will be updated in-place

~ resource "sleuth_code_change_source" "code_change_source" {
id = "planet-express/up-platform-demo-app"
name = "up-platform-demo-app"
# (6 unchanged attributes hidden)

  ~ build_mappings {
      ~ environment_slug = "planet-express/production" -> "production"
        # (3 unchanged attributes hidden)
    }

  ~ environment_mappings {
      ~ environment_slug = "planet-express/production" -> "production"
        # (1 unchanged attribute hidden)
    }

    # (1 unchanged block hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

it would seem that the environment slug is different when it comes from terraform compared to when it is set via the UI in that it also contains the project_slug

Hi @michael-drinker,

thanks for reporting an issue - just to see if I understand the issue - the current issue is that environment_slugs are changed every time you apply a new plan. Or am I missing something and something else is the issue? Interested because we are currently solving the issue with environment slugs as we speak and am curious if current PR might solve this issue.