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

Exported attributes for vcd_vapp resource (vDirector) #4935

Closed
felnne opened this issue Feb 1, 2016 · 5 comments
Closed

Exported attributes for vcd_vapp resource (vDirector) #4935

felnne opened this issue Feb 1, 2016 · 5 comments

Comments

@felnne
Copy link

felnne commented Feb 1, 2016

Hi,

I'm not sure if this has already been discussed and i'm just not seeing something obvious, but is it possible to get any details (i.e. outputs) for vApp resources in vDirector?

My use-case would be to determine the IPv4 address of the first NIC of the first VM within a vApp, such that I can then create a DNS record (as you would with say an EC2 EIP in AWS).

In my case i'd be using Route53 for creating the DNS record but I don't imagine that matters. I am relatively new to vDirector, so i'm not sure if I am missing a more typical way this would be done that means I don't need to know the IP address of each VM.

If it were possible to expose the same outputs as a vSphere VM, which I don't use but look ideal from the documentation, that would be great. Looking at the govcloudair documentation, which I understand is fairly similar to the vdirector library used for this provider, it looks like there is a resource that would be able to return this information.

However since a vApp could contain multiple VMs, each containing network interfaces i'm not sure if this is something that would be considered too complex or unknowable.

This example gives a more specific example of how I would intend to use a feature like this if it existed:

# Example VM - Only accessible privately
#
# This resource implicitly depends on outputs from the the 'terraform_remote_state.BAS-JASMIN' resource
#
# Terraform source: https://www.terraform.io/docs/providers/vcd/r/vapp.html
resource "vcd_vapp" "example-dev-node1" {
    name          = "example-dev-node1"
    catalog_name  = "${terraform_remote_state.BAS-JASMIN.output.BAS-JASMIN-vApp-Template-Catalogue-Name}"
    template_name = "antarctica/trusty-vdirector-0.1.2"
    memory        = 512
    cpus          = 1

    network_name  = "${terraform_remote_state.BAS-JASMIN.output.BAS-JASMIN-Organisation-Network-Name}"

    metadata {
        Name         = "example-dev-node1"
        X-Managed-By = "Terraform"
        X-Project    = "scratch-test"
        X-Purpose    = "node"
    }
}

# This resource implicitly depends on the 'vcd_vapp.example-dev-node1' resource
# This resource implicitly depends on outputs from the the 'terraform_remote_state.BAS-JASMIN' resource
#
# AWS source: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/rrsets-working-with.html
# Terraform source: https://www.terraform.io/docs/providers/aws/r/route53_record.html
#
# Tags are not supported by this resource
resource "aws_route53_record" "example-dev-node1-int" {
    zone_id = "${terraform_remote_state.BAS-JASMIN.output.BAS-JASMIN-Internal-Subdomain-ID}"

    name = "example-dev-node1"
    type = "A"
    ttl = "300"

    records = [
        "${vcd_vapp.example-dev-node1.children.0.NetworkConnectionSection.0.IPAddress}"
    ]
}

The syntax for referencing the IP address of the first network connection within the first VM of a vApp, is purely illustrative.

I'm not sure if this the right place to ask for feature requests - so if there's somewhere else I should redirect this question to please let me know. I had a look for older vDirector issues on here and on the Google Group but couldn't see anything relevant.

Thanks,
Felix.

@robcoward
Copy link
Contributor

Hi @felnne, I've just raised #5159 which may also provide you with a solution. If you provide a static ip when defining your vapp, you can reference it as vcd_vapp.example-dev-node1.ip but when left to DHCP, the ip address allocated to the vm is not known to vcloud director until the open-vm-tools daemon run on the booted vm, after which a terraform refresh does retrieve the respective ip address for you (although too late to be used within the same terraform apply session).

@felnne
Copy link
Author

felnne commented Feb 24, 2016

Hi @robcoward, thanks for that, from that example it looks to solve my issue completely!

Think I will leave this open until I have a chance to test when this is available.

@robcoward
Copy link
Contributor

Hi @felnne. #5195 has been released in v0.6.12 - has this solved your problem for you ?

@felnne
Copy link
Author

felnne commented Mar 16, 2016

Hi, sorry for the delay - yes that now works.

Thanks!

@felnne felnne closed this as completed Mar 16, 2016
@ghost
Copy link

ghost commented Apr 27, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

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

No branches or pull requests

3 participants