Skip to content

Only create ipv4 domain record when enable_public_ipv4 is true #71

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

Merged

Conversation

ricbra
Copy link
Contributor

@ricbra ricbra commented Jun 18, 2025

Given this Terraform configuration:

module "vpc" {
  source  = "scaleway-terraform-modules/vpc/scaleway"
  version = "2.0.0"

  name = "my-cool-name"

  bastion_enabled = true
  enable_routing = true

  gw_enabled = true
  gw_reserve_ip = true
  gw_type = "VPC-GW-S"

  ipv4_subnet = "192.168.0.0/22"
}

module "gitlab-runner-instance" {
  source  = "scaleway-terraform-modules/instance/scaleway"
  version = "3.2.0"

  instance_type = "DEV1-L"
  image         = "debian_bookworm"

  hostname = "gitlab-runner-1"

  enable_ipv6        = false
  enable_public_ipv4 = false

  private_networks = [module.vpc.pn_id]

  root_volume = {
    size_in_gb   = 100
    volume_type = "sbs_volume"
    delete_on_termination = false
  }
}

You always get:

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Missing required argument
│ 
│   with module.gitlab-runner-instance.scaleway_domain_record.ipv4[0],
│   on modules/terraform-scaleway-instance/ipv4.tf line 54, in resource "scaleway_domain_record" "ipv4":
│   54:   dns_zone = var.domainname
│ 
│ The argument "dns_zone" is required, but no definition was found.
╵

It seems if you use private_networks, it always tries to create the scaleway_domain_record regardless of the enable_public_ipv4 variable. This has been fixed in this pull request.

@ricbra ricbra force-pushed the fix-for-required-zone branch from 7f7b648 to 588dcc8 Compare June 18, 2025 13:26
@benoit-garcia benoit-garcia added the bug Something isn't working label Jun 23, 2025
@benoit-garcia benoit-garcia merged commit d9289e1 into scaleway-terraform-modules:main Jun 23, 2025
5 checks passed
@benoit-garcia
Copy link
Member

@ricbra Thanks for your fix!
Approved, merged and release

@ricbra
Copy link
Contributor Author

ricbra commented Jun 24, 2025

Merci beaucoup @benoit-garcia :)

@ricbra ricbra deleted the fix-for-required-zone branch June 24, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants