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

Changing AKS load_balancer_profile settings after creation (#5846) #5847

Merged
merged 19 commits into from Apr 16, 2020

Conversation

aristosvo
Copy link
Collaborator

@aristosvo aristosvo commented Feb 22, 2020

Fixes #5846

Issue

When the load_balancer_profile settings for service/kubernetes-cluster are all computed, changing (for example) from managed IPs to provided outbound IP addresses is not possible with only TerraForm without recreating your cluster.

Changes

With this change applied

  • effective_outbound_ips -> Computed: true (no change)
  • outbound_ip_address_ids -> Computed: false
  • outbound_ip_prefix_ids -> Computed: false
  • managed_outbound_ip_count -> Computed: false

As only one of the three options (outbound_ip_address_ids, outbound_ip_prefix_ids, outbound_ip_prefix_ids ) could be set and at least one of them should be set, Computed: true doesn't make sense to me for the last three and it prevented changes.

If there is a better option to make a change possible, let me know

When the `load_balancer_profile` settings are calculated, changing (for example) from managed IPs to provided outbound IP addresses is not possible.

The `effective_outbound_ips` are still `Computed`, but as only one of the three options `outbound_ip_address_ids`, `outbound_ip_prefix_ids` and `managed_outbound_ip_count` and at least one of them should be set, `Computed` doesnt make sense to me.

If there is a better option to make a change possible, let me know
@ghost ghost added the size/XS label Feb 22, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @aristosvo,

I've offered some suggestions on how we can not remove computed (as that would change behaviour), but could you describe a little more why the cluster needs to be recreated when computed=true?

@ghost ghost added size/M and removed size/XS labels Mar 10, 2020
@aristosvo
Copy link
Collaborator Author

aristosvo commented Mar 10, 2020

could you describe a little more why the cluster needs to be recreated when computed=true?

@katbyte Thanks for your remarks! I've added a test to describe better what I want and implemented your suggestions. Computed: true and ConflictsWith are both nice to keep around, but the desired state of one of the options and the computed state kept each other in deadlock when wanting to switch options after creation.

I implemented some logic to replace ConflictsWith, but you’ll need to set the existing/computed option to 0 or [] when you change to the other option. The error message should make this clear, but is this the best option available or are there better ways? It feels weird not to be able to work out a better solution for this pattern. Something like a MapType but with defined elements, element limitations and element replacement rules..

edit: I think I found a better solution

@ghost ghost removed the waiting-response label Mar 10, 2020
@aristosvo aristosvo changed the title Changing load_balancer_profile settings to computed=false (#5846) Changing AKS load_balancer_profile settings after creation (#5846) Mar 12, 2020
@ghost ghost added size/L and removed size/M labels Mar 18, 2020
@aristosvo
Copy link
Collaborator Author

@katbyte Can you give it another review? I have reworked it a few times and I've finaly a solution which works for me:) With the solution I implemented we can keep both Computed: true and the ConflictsWith rules in the schema.

I'm still learning a lot about Go/TF and enjoying it, don't hold back if you've any improvements!:)

@aristosvo aristosvo requested a review from katbyte March 22, 2020 18:24
@aristosvo
Copy link
Collaborator Author

If I can find the time I'll try to solve the conflicts

@tombuildsstuff
Copy link
Member

@aristosvo awesome, thanks for rebasing this 👍

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @aristosvo

Thanks for this PR :)

Taking a look through this mostly LGTM - so that we can run the tests for this I hope you don't mind but I'm going to push a commit to fix the failing build/pending comments here - once that's done we should be able to run the tests and 🤞hopefully get this into v2.5 of the Azure Provider :)

Thanks!

@tombuildsstuff tombuildsstuff dismissed katbyte’s stale review April 8, 2020 09:32

dismissing since changes have been pushed

@tombuildsstuff tombuildsstuff added this to the v2.5.0 milestone Apr 8, 2020
@aristosvo
Copy link
Collaborator Author

Acceptance test passed!

==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
TF_ACC=1 go test -v ./azurerm/internal/services/containers/tests/ -run=TestAccAzureRMKubernetesCluster_changingLoadBalancerProfile -timeout 60m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccAzureRMKubernetesCluster_changingLoadBalancerProfile
=== PAUSE TestAccAzureRMKubernetesCluster_changingLoadBalancerProfile
=== CONT  TestAccAzureRMKubernetesCluster_changingLoadBalancerProfile
--- PASS: TestAccAzureRMKubernetesCluster_changingLoadBalancerProfile (2014.92s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/containers/tests    2014.990s

@tombuildsstuff
Copy link
Member

Ignoring some expected failures due to capacity issues in Azure - the tests look good:

Screenshot 2020-04-08 at 16 57 04

@aristosvo
Copy link
Collaborator Author

Are these expected failures tracked somewhere? I’m only running targeted acceptance tests, but I was unaware of the failing ones.

@katbyte katbyte modified the milestones: v2.5.0, v2.6.0 Apr 9, 2020
@hashicorp hashicorp deleted a comment Apr 9, 2020
@tombuildsstuff
Copy link
Member

@aristosvo unfortunately that varies test-run to test run due to capacity issues on the Azure side, so that's not easily possible - but we're checking these as we go

@tombuildsstuff tombuildsstuff merged commit d049a36 into hashicorp:master Apr 16, 2020
tombuildsstuff added a commit that referenced this pull request Apr 16, 2020
@ghost
Copy link

ghost commented Apr 16, 2020

This has been released in version 2.6.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.6.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 16, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

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

Successfully merging this pull request may close these issues.

Support for changes in load balancer profile AKS after creation
3 participants