diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4dd7bff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM hashicorp/terraform:light AS runner +MAINTAINER "Dwight Spencer (@denzuko)" + +LABEL org.label-schema.schema-version = "1.0" +LABEL org.label-schema.name "workstation" +LABEL org.label-schema.description "Terraform workload contianier for assets/workstation" + +LABEL org.label-schema.docker.cmd "docker run --rm -ti denzuko/assets/workstation:latest" +LABEL org.label-schema.docker.cmd.prune "docker run --rm -ti denzuko/assets/workstation:latest destroy" +LABEL org.label-schema.docker.cmd.help "docker run --rm -ti denzuko/assets/workstation:latest --help" +LABEL org.label-schema.docker.cmd.debug "docker run --rm -ti denzuko/assets/workstation:latest show" + +WORKDIR /app +COPY main.tf variables.tf /app +RUN terraform init && terraform plan +ENTRYPOINT ["/bin/terraform"] +CMD ["apply"] diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..1e36360 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,39 @@ +$VAGRANT_CONFIG_VERSON = 2 +Vagrant.require_plugin "vagrant-aws" +Vagrant.require_plugin "vagrant-winrm-syncedfolders" + +Vagrant.configure($VAGRANT_CONFIG_VERSION) do |config| + config.vm.box = "dummy" + config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/blob/master/dummy.box?raw=true" + config.vm.communicator = "winrm" + config.vm.guest = :windows + + config.vm.provider :aws do |aws, override| + aws.access_key_id = ENV['AWS_ACCESS_KEY_ID'] + aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"] + aws.keypair_name = ENV["AWS_KEYPAIR_NAME"] + + aws.ami = "ami-fa05b392" + aws.tags = { + 'Name' => ENV["ASSET_NAME"], + 'net.matrix.orgunit' => "Matrix NOC", + 'net.matrix.organization' => "Private Ops", + 'net.matrix.commonname' => "cloud", + 'net.matrix.locality' => "Dallas", + 'net.matrix.state' => "Texas", + 'net.matrix.country' => "USA", + 'net.matrix.environment' => "", + 'net.matrix.application' => "infrastructure", + 'net.matrix.role' => "application services", + 'net.matrix.owner' => "FC13F74B@matrix.net", + 'net.matrix.customer' => "PVT-01", + 'net.matrix.costcenter' => "INT-01" + } + + aws.instance_type = "t3.medium" + aws.region = ENV["AWS_DEFAULT_REGION"] + aws.subnet_id = ENV["AWS_SUBNET"] + aws.security_groups = ENV["AWS_SECURITY_GROUPS"] + override.nfs.functional = false + end +end diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..f27771b --- /dev/null +++ b/main.tf @@ -0,0 +1,9 @@ +module "ecs-windows" { + source = "jjno91/ecs-windows/aws" + version = "0.1.0" + instance_type = "t3.medium" + tags = vars.aws_labels + min_size = 0 + max_size = 1 + env = "ustx-dev-lab" +} diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..061a8f3 --- /dev/null +++ b/variables.tf @@ -0,0 +1,24 @@ +variable "keypair" { default = "${env.AWS_KEYPAIR_NAME}" +variable "instance_type" { default = "t2.micro" } +variable "security_groups" { default = "${env.AWS_SECURITY_GROUPS}" } +variable "monitoring" { default = true } +variable "ami_id" { default = "ami-fa05b392" } +variable "subnet_id" { default = "${env.AWS_SUBNET}" } +variable "region" { default = "${env.AWS_DEFAULT_REGION}" } +variable "aws_labels" { + type = "map" + default = { + "net.matrix.orgunit" = "Matrix NOC" + "net.matrix.organization" = "Private Ops" + "net.matrix.commonname" = "cloud" + "net.matrix.locality" = "Dallas" + "net.matrix.state" = "Texas" + "net.matrix.country" = "USA" + "net.matrix.environment" = "${env.ENVIRONMENT}" + "net.matrix.application" = "infrastructure" + "net.matrix.role" = "application services" + "net.matrix.owner" = "FC13F74B@matrix.net" + "net.matrix.customer" = "PVT-01" + "net.matrix.costcenter" = "INT-01" + } +}