Aleksander Stankiewicz
Aleksander Stankiewicz

Reputation: 550

AWS Cloudformation "include" transform error

I have some template and other partial definition I'd like to include in main template definition. The sample is below (main template).

{
  "AWSTemplateFormatVersion": "2010-09-09",

  "Description": "",

  "Parameters": {
    "Environment": {
      "Type": "String",
      "Description": "Specify Environment: prod | dev ",
      "AllowedValues": [ "prod", "dev" ],
      "Default": "dev"
    }
  },
  
  "Transform": {
    "Name": "AWS::Include",
    "Parameters": {
      "Location": "s3://some-s3-local-bucket/part-1.json"
    }
  },

  "Resources": {
  },

  "Outputs": {
  }
}

Below is a definition of the part to include in main template

{
  "AWSTemplateFormatVersion": "2010-09-09",

  "Description": "",

  "Resources": {
    "hellobucket": {
        "Type": "AWS::S3::Bucket",
        "Properties": {
          "BucketName": { "Fn::Sub": "testbucket-${Environment}" }
        }
    }
  },

  "Outputs": {
  }
}

When I try to create stack based on such definitions I receive strange error like "Template parameters modified by transform". I don't know/see any reason any parameter could be considered as "modified".

I don't want to create many "nested" stacks, because there is a limit on aws in number of stacks I can create so the goal is to split stack definition into many (well managable) smaller files and based on them to create ONE stack with all the related resources.

How to properly decompose bigger stack definition into smaller files?

Upvotes: 0

Views: 1430

Answers (1)

user10775237
user10775237

Reputation:

I haven't done this before but it might be because you are using the transform to pull in a template that creates an s3 bucket BUT the template you are pulling into the original one has all it's parameter fields etc. empty. I think this is what the error message - Template parameters modified by transform - is relating to. Try removing the empty parameters entry from the S3 template to see if that helps.

Upvotes: 1

Related Questions