wttech / aemc

AEM Compose (Core & CLI)
https://wttech.blog/blog/2023/get-your-aem-together-with-aem-compose/
Apache License 2.0
41 stars 6 forks source link

Consider implementing 'aemc-terraform-provider' and pushing module to Terraform Registry #167

Open krystian-panek-vmltech opened 1 year ago

krystian-panek-vmltech commented 1 year ago

responsibilities

all done declaratively, support in-place update when possible

potential problems:

resource candidates:

resource "aws_instance" "aem_author" {
  // ...
}

resource "aem_aws_instance" "aem_author" {
  aws {
    id  = aws_instance.aem.id
    ssm = true // prefer SSM over SSH when connecting to instance to provision it
  }

  config {
    instance_id = "local_author"
    file        = "aem.yml"  // or yml inline below

    inline = <<EOT
      instance:
        config:
          local_author:
            http_url: http://127.0.0.1:4502
            user: admin
            password: admin
            run_modes: [ int ]
            jvm_opts:
              - -server
              - -Djava.awt.headless=true
              - -Djava.io.tmpdir=[[canonicalPath .Path "aem/home/tmp"]]
              - -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:14502
              - -Duser.language=en
              - -Duser.country=US
              - -Duser.timezone=UTC
            start_opts: []
            secret_vars:
              - ACME_SECRET=value
            env_vars:
              - ACME_VAR=value
            sling_props: []
      EOT
  }

  provision {
    commands = [
      // assumes usage of standard 'changed' field returned by AEMC
      ["pkg", "deploy", "--url", "http://github.com/../some-pkg.zip"],
      ["osgi", "config", "save", "--pid", "xxx", "props", "a: 'b'"]
    ]

    // nicely propagates 'changed' to TF (update in place), also automatically uploads packages to AEM
    packages = [
      "http://github.com/../some-pkg.zip",
      "packages/core-components.zip"
      "packages/content-large.zip" // use checksums to avoid re-uploading big packages
    ]

    // or as a last resort (without telling 'changed' to TF) 
    shell = <<EOT
        sh aemw pkg deploy --url "http://github.com/../some-pkg.zip"
        sh aemw [do ant
    EOT
  }
}
krystian-panek-vmltech commented 1 year ago

also consider implementing AEMC Packer Provisioner - https://developer.hashicorp.com/packer/docs/plugins/creation/custom-provisioners