Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/bitbucket fork_policy not updated correctly #9529

Closed
ksatirli opened this issue Oct 23, 2016 · 8 comments
Closed

provider/bitbucket fork_policy not updated correctly #9529

ksatirli opened this issue Oct 23, 2016 · 8 comments

Comments

@ksatirli
Copy link
Member

Hi there,

I'm running into a problem with the bitbucket_repository resource. It seems remote fields are not correctly updated, even though they are stored in the tfstate file.

This ticket is specific to fork_policy, but I've noticed similar issues with is_private and language.

Terraform Version

Terraform v0.7.7

Affected Resource(s)

  • bitbucket_repository

Terraform Configuration Files

resource "bitbucket_repository" "test-repository" {
  owner = "${var.bitbucket_username}"
  name = "test-repository-3kjh4asdkj"
  is_private = "true"
  language = "other"
  fork_policy = "no_forks"
}

Note: in the above example, bitbucket_username is just the same username used to configure the provider itself.

Panic Output

no panic

Expected Behavior

The fork_policy should be set on an initial run and then only show up as changed when it actually has changed

Actual Behavior

The fork_policy shows as changed on every run.

Steps to Reproduce

  1. terraform apply
  2. inspect initial output:
+ bitbucket_repository.test-repository
    clone_https: "<computed>"
    clone_ssh:   "<computed>"
    fork_policy: "no_forks"
    has_issues:  "false"
    has_wiki:    "false"
    is_private:  "true"
    language:    "other"
    name:        "test-repository-3kjh4asdkj"
    owner:       "my-bitbucket-username"
    scm:         "git"
  1. Another terraform apply will then show that the resource has been updated, again. This shows up as changed resource on every run.

Important Factoids

n/a

@cwood
Copy link
Contributor

cwood commented Nov 2, 2016

I dont get this at all.

╭─cwood@cwood  ~/Projects/playground/terraform
╰─♥ terraform apply
bitbucket_repository.test-repository: Creating...
  clone_https: "" => "<computed>"
  clone_ssh:   "" => "<computed>"
  fork_policy: "" => "no_forks"
  has_issues:  "" => "false"
  has_wiki:    "" => "false"
  is_private:  "" => "true"
  language:    "" => "other"
  name:        "" => "test-repository-3kjh4asdkj"
  owner:       "" => "colinbits"
  scm:         "" => "git"
bitbucket_repository.test-repository: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path: terraform.tfstate
╭─cwood@cwood  ~/Projects/playground/terraform
╰─♥ 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.

bitbucket_repository.test-repository: Refreshing state... (ID: colinbits/test-repository-3kjh4asdkj)

No changes. Infrastructure is up-to-date. This means that Terraform
could not detect any differences between your configuration and
the real physical resources that exist. As a result, Terraform
doesn't need to do anything.
╭─cwood@cwood  ~/Projects/playground/terraform
╰─♥ terraform apply
bitbucket_repository.test-repository: Refreshing state... (ID: colinbits/test-repository-3kjh4asdkj)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

@cwood
Copy link
Contributor

cwood commented Nov 2, 2016

This might be a issue with the PUT api. Ill take a look.

@cwood
Copy link
Contributor

cwood commented Nov 2, 2016

I just talked to our devs and the issue is with is_private and forking_policy. It can only be set on create and can not be updated yet. I can set this to on change to delete and create the repo.

@ksatirli
Copy link
Member Author

ksatirli commented Nov 9, 2016

Apologies for the late reply @cwood and thank you for your patience.

I just tried my original code and was indeed unable to reproduce it. I'll chalk it up to a ghost in the machine.

That being said, I do see issues with the PUT API and it marking resources as having pending changes on every run.

Setting this to "on change -> delete" seems dangerous (unless I am misunderstanding). I certainly wouldn't want to lose a repo just because I updated a flag in TF.

@cwood
Copy link
Contributor

cwood commented Nov 9, 2016

The bug is submitted internally, for now, this is more an issue with the bitbucket API then with terraform. The code that handles the fork policy is really just two flags and it will block based on is_private or not.

Eg; if you set is_private to False from True it wont allow you to unless the forking policy. Depending on your change bitbucket might allow you through.

@ksatirli
Copy link
Member Author

ksatirli commented Dec 7, 2016

Thanks for the clarification @cwood!

Do you have any updates at this point?

@cwood
Copy link
Contributor

cwood commented Dec 8, 2016

Not super this has been ticketed in our Jira. Ill see if I can poke seomeone on our API team to handle this.

@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants