Skip to content

Docs - add TF deployment snippet #684

Closed
@DanyC97

Description

@DanyC97

What were you initially searching for in the docs?

I was looking for an example of how to deploy the layer using terraform. In case the library was published as a public layer (in addition to SAR app) - see more mentioned here would have been perfect as then it was trivial as per the TF docs

Is this related to an existing part of the documentation? Please share a link
in the homepage we have examples for sar/ cdk and so we could maybe have another tab for TF?

Describe how we could make it clearer
Have an example on how it could be done

If you have a proposed update, please share it here
I think a snippet like below will do, folks familiar with TF will understand and tweak it as per their needs

$ cat main.tf
terraform {
  required_version = "~> 0.13"
  required_providers {
    aws = "~> 3.50.0"
  }
}

provider "aws" {
  region = "us-east-1"
  profile = "dev-apptest8"
}

data aws_serverlessapplicationrepository_application app {
  application_id   = "arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer"
  semantic_version = "1.18.0"
}

resource aws_serverlessapplicationrepository_cloudformation_stack deploy_sar_stack {
  name = "aws-lambda-powertools-python-layer-dev"

  application_id = data.aws_serverlessapplicationrepository_application.app.application_id
  semantic_version = data.aws_serverlessapplicationrepository_application.app.semantic_version
  capabilities = [
        "CAPABILITY_IAM",
        "CAPABILITY_NAMED_IAM"
  ]
}

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions