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

fix: main_domain option doesn't work for testnet #206

Merged
merged 3 commits into from
Dec 28, 2020

Conversation

strophy
Copy link
Collaborator

@strophy strophy commented Dec 27, 2020

This PR fixes errors preventing DNS registration when using testnet config. Together with this PR to the config, it should resolve DNS errors for testnet.

Issue being fixed or feature implemented

Terraform was failing with:

data.template_file.ansible_inventory: Refreshing state...

Error: Invalid index

  on main.tf line 136, in resource "aws_route53_record" "faucet":
 136:   records = [aws_elb.web[0].dns_name]
    |----------------
    | aws_elb.web is empty tuple

The given key does not identify an element in this collection value.


Error: Invalid index

  on main.tf line 147, in resource "aws_route53_record" "insight":
 147:   records = [aws_elb.web[0].dns_name]
    |----------------
    | aws_elb.web is empty tuple

The given key does not identify an element in this collection value.

What was done?

  • instantiate required public_network_name in variable by specifying NETWORK_DEVNET_NAME with non-devnet networks
  • user >= operator instead of > to ensure count is 1 when creating aws_elb

This should result in tuples for aws_elb.web[0].dns_name existing when subsequently attempting to create routes.

How Has This Been Tested?

dash-network list testnet works again, dash-network deploy -i testnet indicates it will deploy records correctly as follows:

# aws_elb.web[0] will be created
  + resource "aws_elb" "web" {
      + arn                         = (known after apply)
      + availability_zones          = (known after apply)
      + connection_draining         = false
      + connection_draining_timeout = 300
      + cross_zone_load_balancing   = true
      + dns_name                    = (known after apply)
      + id                          = (known after apply)
      + idle_timeout                = 60
      + instances                   = [
          + "i-0d95571ca4ca6cecd",
        ]
      + internal                    = (known after apply)
      + name                        = "testnet"
      + security_groups             = [
          + "sg-0e4a916801c9749e8",
        ]
      + source_security_group       = (known after apply)
      + source_security_group_id    = (known after apply)
      + subnets                     = [
          + "subnet-05fa2e7ea1d0d5f7b",
          + "subnet-09df015ece18f95f7",
          + "subnet-0d7b45223ef4ea9c4",
        ]
      + tags                        = {
          + "DashNetwork" = "testnet"
          + "Name"        = "dn-testnet-web"
        }
      + zone_id                     = (known after apply)

      + health_check {
          + healthy_threshold   = 2
          + interval            = 20
          + target              = "HTTP:80/"
          + timeout             = 3
          + unhealthy_threshold = 2
        }

      + listener {
          + instance_port     = 3001
          + instance_protocol = "http"
          + lb_port           = 3001
          + lb_protocol       = "http"
        }
      + listener {
          + instance_port     = 80
          + instance_protocol = "http"
          + lb_port           = 80
          + lb_protocol       = "http"
        }
    }

  # aws_route53_record.faucet[0] will be created
  + resource "aws_route53_record" "faucet" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "faucet.testnet.networks.dash.org"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "CNAME"
      + zone_id         = "Z0875113JJTK7DOU978T"
    }
...

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

lib/cli/init.sh Outdated Show resolved Hide resolved
@shumkov shumkov changed the title Fix testnet dns fix: main_domain option doesn't work for testnet Dec 28, 2020
@shumkov shumkov added this to the v0.17 milestone Dec 28, 2020
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

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

👍

@shumkov shumkov merged commit 6183321 into dashpay:v0.17-dev Dec 28, 2020
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.

2 participants