AWS AppStream has finally made its way into the Terraform AWS Provider.

If you are using hashicorp/aws version 3.67 or above, then you can do the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
terraform {
  required_version = "~> 1.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.67"
    }
  }
}
provider "aws" {
  region = "eu-west-1"
  default_tags {
    tags = {
      Contact = "[email protected]"
      Environment = "dev"
      DeployedBy = "Automation:Terraform"
    }
  }
}

resource "aws_appstream_fleet" "example" {
  name          = "ao-tmp-fleet-1"
  image_name    = "Amazon-AppStream2-Sample-Image-02-04-2019"
  instance_type = "stream.standard.small"

  compute_capacity {
    desired_instances = 1
  }
}
resource "aws_appstream_stack" "example" {
  name = "ao-tmp-stack-1"
}
resource "aws_appstream_fleet_stack_association" "example" {
  fleet_name = aws_appstream_fleet.example.name
  stack_name = aws_appstream_stack.example.name
}