Merge pull request #186 from vvbogdanov87/genymotion-subnetid

Add subnet_id parameter [Genymotion on AWS]
This commit is contained in:
Budi Utomo 2019-08-12 14:12:20 +02:00 committed by GitHub
commit c27ab1d6d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -24,4 +24,18 @@ You can easily scale your Appium tests on Genymotion Android virtual devices in
docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -v ~/.aws:/root/.aws -e TYPE=aws budtmo/docker-android-genymotion
```
Existing security group and subnet can be used:
```json
[
{
"region": "us-west-2",
"instance": "t2.small",
"AMI": "ami-0673cbd39ef84d97c",
"SG": "sg-000aaa",
"subnet_id": "subnet-000aaa"
}
]
```
You can also use [this docker-compose file](genymotion/example/geny.yml).

View file

@ -59,12 +59,17 @@ function prepare_geny_aws() {
instance=$(get_value '.instance')
ami=$(get_value '.AMI')
sg=$(get_value '.SG')
subnet_id=$(get_value '.subnet_id')
if [[ $subnet_id == null ]]; then
subnet_id=""
fi
echo $region
echo $android_version
echo $instance
echo $ami
echo $sg
echo $subnet_id
#TODO: remove this dirty hack
if [[ $android_version == null ]]; then
@ -183,6 +188,11 @@ variable "instance_type_$index" {
default = "$instance"
}
variable "subnet_id_$index" {
type = "string"
default = "$subnet_id"
}
provider "aws" {
alias = "provider_$index"
region = "\${var.aws_region_$index}"
@ -214,6 +224,7 @@ resource "aws_instance" "geny_aws_$index" {
provider = "aws.provider_$index"
ami="\${data.aws_ami.geny_aws_$index.id}"
instance_type = "\${var.instance_type_$index}"
subnet_id = "\${var.subnet_id_$index}"
vpc_security_group_ids=["\${aws_security_group.geny_sg_$index.name}"]
key_name = "\${aws_key_pair.geny_key_$index.key_name}"
tags {