Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
krystian-panek-wttech opened this issue Aug 14, 2023 · 1 comment
Labels
new feature Completely a new feature (not existing before)

Comments

@krystian-panek-wttech
Copy link
Contributor

krystian-panek-wttech commented Aug 14, 2023

responsibilities

  • set up and update the AEM instance
  • deploy AEM packages

all done declaratively, support in-place update when possible

potential problems:

resource candidates:

  • aem_instance - provisioning via SSH connection (cloud agnostic)
  • aem_aws_instance - provisioning via AWS SSM (dedicated to AWS, SSH-less)
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-wttech krystian-panek-wttech added the new feature Completely a new feature (not existing before) label Aug 14, 2023
@krystian-panek-wttech
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Completely a new feature (not existing before)
Projects
None yet
Development

No branches or pull requests

1 participant