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

OpenStack support? #14

Closed
adrianlop opened this issue Jul 8, 2015 · 6 comments
Closed

OpenStack support? #14

adrianlop opened this issue Jul 8, 2015 · 6 comments

Comments

@adrianlop
Copy link

Hi Adam,

Nice job here.
Will you support Openstack provider anytime soon? I'd appreciate it a lot :)

Thanks in advance.

Regards,
Adrián.

@adammck
Copy link
Owner

adammck commented Jul 8, 2015

I'd love to support OpenStack, but I have no idea how it works. I could guess based on the docs, but it would be better to work from actual examples. Could you provide a state file with at least one (redacted) openstack_compute_instance_v2 resource?

@adrianlop
Copy link
Author

Sure, here you go (sorry for the delay):

Resource definition:

resource "openstack_compute_instance_v2" "cassandra" {
  count = 2
  name = "cassandra${format("%02d", count.index+1)}"
  image_name = "${var.image_name}"
  region = "${var.region}"
  flavor_name = "${var.flavor_name_cassandra}"
  #floating_ip = "${openstack_networking_floatingip_v2.floatip_1.address}"
  network {
    uuid = "${var.network_id}"
  }
  metadata {
    ssh_user = "ubuntu"
    ansible_group = "cassandra-nodes"
  }
  key_pair = "${var.openstack_key_pair}"
  security_groups = ["${var.security_group}"]
}

Resulting tfstate:

"resources": {
                "openstack_compute_instance_v2.cassandra-node.0": {
                    "type": "openstack_compute_instance_v2",
                    "primary": {
                        "id": "1234b77-eb5e-4b5b-a4c2-da6ce31aad97",
                        "attributes": {
                            "access_ip_v4": "10.120.0.226",
                            "access_ip_v6": "",
                            "flavor_id": "e23157e-f707-4644-b598-0455328d46f1",
                            "flavor_name": "m1.medium",
                            "id": "xxfd1b77-eb5e-4b5b-a4c2-da6ce31aad97",
                            "image_id": "331deee5-95fa-401c-b1b8-5f433b59d97f",
                            "image_name": "Ubuntu 14.04",
                            "key_pair": "test",
                            "metadata.#": "2",
                            "metadata.ansible_group": "cassandra-nodes",
                            "metadata.ssh_user": "ubuntu",
                            "name": "cassandra-node01",
                            "network.#": "1",
                            "network.0.fixed_ip_v4": "10.120.0.226",
                            "network.0.fixed_ip_v6": "",
                            "network.0.mac": "fa:16:3e:ca:53:43",
                            "network.0.name": "demo-net",
                            "network.0.port": "",
                            "network.0.uuid": "edca5d6a-596b-4996-8f6d-20a415edebbf",
                            "region": "regionOne",
                            "security_groups.#": "1",
                            "security_groups.0": "LAN"
                        }
                    }
                },
                "openstack_compute_instance_v2.cassandra-node.1": {
                    "type": "openstack_compute_instance_v2",
                    "primary": {
                        "id": "2669d6b-f02a-4c5e-9483-a2b2bb50eac7",
                        "attributes": {
                            "access_ip_v4": "10.120.0.229",
                            "access_ip_v6": "",
                            "flavor_id": "953rf57e-f707-4644-b598-0455328d46f1",
                            "flavor_name": "m1.medium",
                            "id": "24zxcd6b-f02a-4c5e-9483-a2b2bb50eac7",
                            "image_id": "98frtye5-95fa-401c-b1b8-5f433b59d97f",
                            "image_name": "Ubuntu 14.04",
                            "key_pair": "terraform-test",
                            "metadata.#": "2",
                            "metadata.ansible_group": "cassandra-nodes",
                            "metadata.ssh_user": "ubuntu",
                            "name": "cassandra-node02",
                            "network.#": "1",
                            "network.0.fixed_ip_v4": "10.120.0.229",
                            "network.0.fixed_ip_v6": "",
                            "network.0.mac": "fa:16:3e:fc:05:7b",
                            "network.0.name": "demo-net",
                            "network.0.port": "",
                            "network.0.uuid": "11111d6a-596b-4996-8f6d-20a415edebbf",
                            "region": "regionOne",
                            "security_groups.#": "1",
                            "security_groups.0": "LAN"
                        }
                    }
                }
  }

Thanks in advance! If you need anything else please tell me.

rphillips pushed a commit to rphillips/terraform-inventory that referenced this issue Jul 31, 2015
@rphillips
Copy link
Contributor

This minor tweak works for me.

@kvz
Copy link
Contributor

kvz commented Oct 6, 2015

Hi there,

I'm planning to use terraform-inventory in a pretty ambitious open source project that's able to deploy to many different cloud providers.

I'm running into a few issues, such as openstack not being supported.

Here's my openstack state:

$ cat .frey/state/terraform.tfstate
{
    "version": 1,
    "serial": 20,
    "modules": [
        {
            "path": [
                "root"
            ],
            "outputs": {},
            "resources": {
                "openstack_compute_instance_v2.freytest-server-1": {
                    "type": "openstack_compute_instance_v2",
                    "depends_on": [
                        "openstack_compute_secgroup_v2.freytest-secgroup-1"
                    ],
                    "primary": {
                        "id": "54d0877f-2382-4372-9325-f193c4257be3",
                        "attributes": {
                            "access_ip_v4": "",
                            "access_ip_v6": "",
                            "flavor_id": "3",
                            "flavor_name": "m1.medium",
                            "id": "54d0877f-2382-4372-9325-f193c4257be3",
                            "image_id": "cb6b7936-d2c5-4901-8678-c88b3a6ed84c",
                            "image_name": "ubuntu14.04-LTS",
                            "key_pair": "freytest-keypair-1",
                            "metadata.#": "1",
                            "metadata.frey": "yes please",
                            "name": "freytest-server-1",
                            "network.#": "1",
                            "security_groups.#": "0"
                        }
                    }
                },
                "openstack_compute_keypair_v2.freytest-keypair-1": {
                    "type": "openstack_compute_keypair_v2",
                    "primary": {
                        "id": "freytest-keypair-1",
                        "attributes": {
                            "id": "freytest-keypair-1",
                            "name": "freytest-keypair-1",
                            "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDe33HmuH6x/JLVJAkPg9EYHCdFoILCMJefBzIIWJ0BKlTfZPHHndFhyKFA7PStMiwntkd1XcqP5kL2VyJXHB6gMNHcqQ4XBEK8hDdESK3r1Gp4YP2RzqO5KEaQzjw0zrEr8dWm8kzAjhlkqq89sAFA+FC833wdW5NCGT+aQWKhdcJVhl89ppfPgJVXpeQ5ZuGWvOdxJM3h1V0GL8I+0NFb7MuOEneGezth1VIOL+eJJeAMzBWcXO6cAWZG31JkCuNpOG9vDhjYPim+tsozTdRg6g7R0Fmikxw3c3PFEOVKSmDXbOKLVTaXCYvDR0wOM+cLFOzSPl7Dt4aAMBT2h1xL [email protected]\n"
                        }
                    }
                },
                "openstack_compute_secgroup_v2.freytest-secgroup-1": {
                    "type": "openstack_compute_secgroup_v2",
                    "primary": {
                        "id": "84083f80-7464-4cb7-9c06-3255d3e04a93",
                        "attributes": {
                            "description": "freytest-secgroup-1",
                            "id": "84083f80-7464-4cb7-9c06-3255d3e04a93",
                            "name": "freytest-secgroup-1",
                            "rule.#": "2",
                            "rule.0.cidr": "0.0.0.0/0",
                            "rule.0.from_group_id": "",
                            "rule.0.from_port": "22",
                            "rule.0.id": "",
                            "rule.0.ip_protocol": "tcp",
                            "rule.0.self": "false",
                            "rule.0.to_port": "22",
                            "rule.1.cidr": "0.0.0.0/0",
                            "rule.1.from_group_id": "",
                            "rule.1.from_port": "80",
                            "rule.1.id": "",
                            "rule.1.ip_protocol": "tcp",
                            "rule.1.self": "false",
                            "rule.1.to_port": "80"
                        }
                    }
                }
            }
        }
    ]
}

Feel free to use it, it's as vanilla as can be and does not contain any data that should be private (the account used is a throw-away one from trystack.org, the keys are freshly generated just now)

@adammck
Copy link
Owner

adammck commented Nov 5, 2015

@kvz Thanks very much for submitting your statefile. But I don't see any IP addresses in it. Were those redacted? My understanding is that the access_ip_v4 attr is expected to contain it.

@adammck adammck closed this as completed in d2d7b52 Nov 5, 2015
@kvz
Copy link
Contributor

kvz commented Nov 12, 2015

I just tested with 0.6-pre and confirmed this is working for me too 💯

Nice find about access_ip_v4, I had an unrelated misconfigured network section - sorry for posting corrupt states :)

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

No branches or pull requests

4 participants