Fetches the URL of the created Cloud9 EC2 environment using the instance's region and ID.

Terraform Template

data "aws_instance" "cloud9_instance" {

  filter {
    name = "tag:aws:cloud9:environment"
    values = [aws_cloud9_environment_ec2.example.id]
  }
}

resource "aws_cloud9_environment_ec2" "example" {
  instance_type = "t2.micro"
}

output "cloud9_url" {
  value = "https://${var.region}.console.aws.amazon.com/cloud9/ide/${aws_cloud9_environment_ec2.example.id}"
}