Skip to content

Conversation

@m-matth
Copy link
Contributor

@m-matth m-matth commented Jan 2, 2023

a Terraform script with default zone different from Lb one, will fail to create the Lb frontend on the correct zone, leading to a error 400.

This PR set the frontend resource zone according to the related lb. Also add some zone related check.

@codecov-commenter
Copy link

Codecov Report

Merging #1671 (9f25f4e) into master (4d4491d) will decrease coverage by 0.03%.
The diff coverage is 21.05%.

@@            Coverage Diff             @@
##           master    #1671      +/-   ##
==========================================
- Coverage   73.67%   73.64%   -0.04%     
==========================================
  Files         145      145              
  Lines       23627    23645      +18     
==========================================
+ Hits        17407    17413       +6     
- Misses       4695     4703       +8     
- Partials     1525     1529       +4     
Impacted Files Coverage Δ
scaleway/resource_lb.go 69.02% <14.28%> (-1.07%) ⬇️
scaleway/resource_lb_frontend.go 76.77% <25.00%> (-1.62%) ⬇️
scaleway/retryable_transport.go 73.21% <0.00%> (+5.35%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Codelax
Copy link
Member

Codelax commented Jan 2, 2023

Hi thanks for your contribution.

The issue with zoned and regional IDs is that we cannot enforce usage of this format.
The following snippets should work:

resource "scaleway_lb_ip" "main" {
  zone = "fr-par-1"
}

resource "scaleway_lb" "base" {
  ip_id  = scaleway_lb_ip.main.id
  zone   = scaleway_lb_ip.main.zone
  type   = "LB-S"
}

and

resource "scaleway_lb" "base" {
  ip_id  = "xxxx-xxxx-xxxx-xxxx"
  type   = "LB-S"
}

User is able to use a locality ID aswell as a bare ID.
Also, as we can see in lb documentation basic's example (which is the first snippet before), the recommended way is to pass down locality from one resource to another if you want to guarantee they are in the same one.

This is still a great issue that you have highlighted, we should provide more errors when validating a config.

@m-matth
Copy link
Contributor Author

m-matth commented Jan 2, 2023

i see, then it needs to add a zone parameter to every lb ressource as it misse for frontend, backend and route. (as well as as some other param like project_id maybe).

The associated use case is creating one lb on each zone.

@Codelax
Copy link
Member

Codelax commented Jan 2, 2023

Ok, thanks for this, I will make a pass on it.
It should be ok in the next release, sorry for the inconvenience.

@Codelax Codelax merged commit eed6df7 into scaleway:master Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants