How to Create AWS AppStream Resources in Terraform


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:

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
}