refactor
parent
b96277bdb1
commit
4ef52dca44
@ -1 +1,3 @@
|
||||
*.tfstate
|
||||
*.tfstate.backup
|
||||
*.pyc
|
@ -0,0 +1,24 @@
|
||||
variable "access_key" {}
|
||||
variable "secret_key" {}
|
||||
|
||||
provider "aws" {
|
||||
access_key = "${var.access_key}"
|
||||
secret_key = "${var.secret_key}"
|
||||
region = "us-west-2"
|
||||
}
|
||||
|
||||
resource "aws_instance" "ubuntu-1404" {
|
||||
ami = "ami-9abea4fb"
|
||||
instance_type = "t2.micro"
|
||||
security_groups = ["terraform-salty-splunk"]
|
||||
tags {
|
||||
Name = "python-terraform-test"
|
||||
}
|
||||
// key_name = "${aws_key_pair.key.key_name}"
|
||||
// connection {
|
||||
// type = "ssh"
|
||||
// user = "ubuntu"
|
||||
// key_file = "${var.key_path}"
|
||||
// timeout = "10m"
|
||||
// }
|
||||
}
|
@ -1,20 +1,15 @@
|
||||
from terraform import Terraform
|
||||
from python_terraform import Terraform
|
||||
|
||||
|
||||
class TestTerraform:
|
||||
def test_apply(self):
|
||||
tf = Terraform()
|
||||
|
||||
tf.apply()
|
||||
def test_apply_and_destory(self):
|
||||
tf = Terraform()
|
||||
ret_code, out, err = tf.apply()
|
||||
|
||||
def test_refresh(self):
|
||||
tf = Terraform()
|
||||
print out
|
||||
print err
|
||||
# assert ret_code, 0
|
||||
|
||||
tf.refresh()
|
||||
ret_code, out, err = tf.destroy()
|
||||
|
||||
def test_destroy(self):
|
||||
tf = Terraform()
|
||||
|
||||
tf.destroy()
|
||||
|
||||
|
||||
assert ret_code, 0
|
||||
|
Loading…
Reference in New Issue