Exporting service config to terraform

Comments

3 comments

  • Satoshi Ishii

    Hi,

    Unfortunately there does not seem to be tool to export to teraform format. You need to create configuration based on API response of Fastly configuration. In the future, teraform import supports to generate configuration. https://www.terraform.io/docs/import/index.html

    Thanks, Satoshi

    0
    Comment actions Permalink
  • tenz

    you can use the import function to import services into your terraform state file, however, you must still define the items in your xxx.tf files. it does make it somewhat easier having them opened side by side instead of trying to create from the webui.

    set up your provider, and create an empty resource block:

    resource "fastly_service_v1" "service_name" {
      }
    

    then run

    terraform import fastly_service_v1.service_name SERVICEID
    

    where SERVICEID is the service ID from your service.

    now you can write out your service in a tf file.

    0
    Comment actions Permalink
  • stanleegoodspeed

    Thanks, this was super helpful!

    0
    Comment actions Permalink

Please sign in to leave a comment.