code: def get_available_tf_versions(include_prerelease=False):
      
      tf_releases = json.loads(
          requests.get('https://releases.hashicorp.com/index.json').text
      )['terraform']
      tf_versions = sorted([k  # descending
                            for k, _v in tf_releases['versions'].items()],
                           key=LooseVersion,
                           reverse=True)
      if include_prerelease:
          return tf_versions
      return [i for i in tf_versions if '-' not in i]
docs: Return available Terraform versions.