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

Problema com ingress atualização do provider GCP #11

Open
hazkall opened this issue Nov 28, 2021 · 0 comments
Open

Problema com ingress atualização do provider GCP #11

hazkall opened this issue Nov 28, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@hazkall
Copy link
Contributor

hazkall commented Nov 28, 2021

Descrevendo o problema

Devido a mudança no provider Google Cloud pela hashicorp, será necessário corrigir o modulo network para que seja comply com os requerimentos da function no caminho:

https://github.com/hashicorp/terraform-provider-google/pull/10369/files

A correção deverá ser feita na condição ternaria do Ingress.

Reproduzindo o problema

Essa função que esta causando problema no terraform.

// Per https://github.com/hashicorp/terraform-provider-google/issues/2924
// Make one of the source_ parameters Required in ingress google_compute_firewall
func resourceComputeFirewallSourceFieldsCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error {
	direction := diff.Get("direction").(string)

	if direction != "EGRESS" {
		_, tagsOk := diff.GetOk("source_tags")
		_, rangesOk := diff.GetOk("source_ranges")
		_, sasOk := diff.GetOk("source_service_accounts")

		_, tagsExist := diff.GetOkExists("source_tags")
		// ranges is computed, but this is what we're trying to avoid, so we're not going to check this
		_, sasExist := diff.GetOkExists("source_service_accounts")

		if !tagsOk && !rangesOk && !sasOk && !tagsExist && !sasExist {
			return fmt.Errorf("one of source_tags, source_ranges, or source_service_accounts must be defined")
		}
	}

	return nil
}

DoD

[ ] Corrigir if ternario do ingress, para atender as necessidades da mudança do provider.

@hazkall hazkall added the bug Something isn't working label Nov 28, 2021
hazkall added a commit to hazkall/iac-modulo-rede-gcp that referenced this issue Nov 30, 2021
    No if ternario para associação de sources ranges e source tags a logica
    estava invertida, onde o EGRESS estava utilizando as variaveis de origem
    e o INGRESS estava utilizando as variaveis de destino.

    Feita também a correção da variavel firewall_allow que recebe as portas
    do firewall, atualmente ela recebe somente numbers impossibilitando
    receber portas em range. Exemplo 10000 - 15000.

    Ref: mentoriaiac#11

    Revisado por:

    Signed-off-by: Felipe Nobrega <lipenodias@gmail.com>
    Co-authored-by: Marcelo Mansur <mansur.ufmg@gmail.com>
    Co-authored-by: Vitor Junior <vitorjr81@gmail.com>
    Co-authored-by: Guilherme Xavier <guilherme.lnx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant