We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Tagging CloudFormation - Error: Parameters must have value
Initially the stack is created with an input parameter.

**c7n policy**
```
policies:
  - name: add-cfn-tag
    resource: cfn
    filters:
      - "tag:testcfn": present
    actions:
      - type: tag
        value: abc
        key: BusinessUnit
```
**Error**
An error occurred (ValidationError) when calling the UpdateStack operation: Parameters: [input_param] must have values

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `c7n/resources/cfn.py`
Content:
```
1 # Copyright 2015-2017 Capital One Services, LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from __future__ import absolute_import, division, print_function, unicode_literals
15 
16 import logging
17 
18 from concurrent.futures import as_completed
19 
20 from c7n.actions import BaseAction
21 from c7n.manager import resources
22 from c7n.query import QueryResourceManager
23 from c7n.utils import local_session, type_schema
24 from c7n.tags import RemoveTag, Tag
25 
26 log = logging.getLogger('custodian.cfn')
27 
28 
29 @resources.register('cfn')
30 class CloudFormation(QueryResourceManager):
31 
32     class resource_type(object):
33         service = 'cloudformation'
34         type = 'stack'
35         enum_spec = ('describe_stacks', 'Stacks[]', None)
36         id = 'StackName'
37         filter_name = 'StackName'
38         filter_type = 'scalar'
39         name = 'StackName'
40         date = 'CreationTime'
41         dimension = None
42         config_type = 'AWS::CloudFormation::Stack'
43 
44 
45 @CloudFormation.action_registry.register('delete')
46 class Delete(BaseAction):
47     """Action to delete cloudformation stacks
48 
49     It is recommended to use a filter to avoid unwanted deletion of stacks
50 
51     :example:
52 
53     .. code-block:: yaml
54 
55             policies:
56               - name: cloudformation-delete-failed-stacks
57                 resource: cfn
58                 filters:
59                   - StackStatus: ROLLBACK_COMPLETE
60                 actions:
61                   - delete
62     """
63 
64     schema = type_schema('delete')
65     permissions = ("cloudformation:DeleteStack",)
66 
67     def process(self, stacks):
68         with self.executor_factory(max_workers=10) as w:
69             list(w.map(self.process_stacks, stacks))
70 
71     def process_stacks(self, stack):
72         client = local_session(
73             self.manager.session_factory).client('cloudformation')
74         client.delete_stack(StackName=stack['StackName'])
75 
76 
77 @CloudFormation.action_registry.register('set-protection')
78 class SetProtection(BaseAction):
79     """Action to disable termination protection
80 
81     It is recommended to use a filter to avoid unwanted deletion of stacks
82 
83     :example:
84 
85     .. code-block:: yaml
86 
87             policies:
88               - name: cloudformation-disable-protection
89                 resource: cfn
90                 filters:
91                   - StackStatus: CREATE_COMPLETE
92                 actions:
93                   - type: set-protection
94                     state: False
95     """
96 
97     schema = type_schema(
98         'set-protection', state={'type': 'boolean', 'default': False})
99 
100     permissions = ('cloudformation:UpdateStack',)
101 
102     def process(self, stacks):
103         client = local_session(
104             self.manager.session_factory).client('cloudformation')
105 
106         with self.executor_factory(max_workers=3) as w:
107             futures = {}
108             for s in stacks:
109                 futures[w.submit(self.process_stacks, client, s)] = s
110             for f in as_completed(futures):
111                 s = futures[f]
112                 if f.exception():
113                     self.log.error(
114                         "Error updating protection stack:%s error:%s",
115                         s['StackName'], f.exception())
116 
117     def process_stacks(self, client, stack):
118         client.update_termination_protection(
119             EnableTerminationProtection=self.data.get('state', False),
120             StackName=stack['StackName'])
121 
122 
123 @CloudFormation.action_registry.register('tag')
124 class CloudFormationAddTag(Tag):
125     """Action to tag a cloudformation stack
126 
127     :example:
128 
129     .. code-block: yaml
130 
131         policies:
132           - name: add-cfn-tag
133             resource: cfn
134             filters:
135               - 'tag:DesiredTag': absent
136             actions:
137               - type: tag
138                 key: DesiredTag
139                 value: DesiredValue
140     """
141     permissions = ('cloudformation:UpdateStack',)
142 
143     def process_resource_set(self, stacks, tags):
144         client = local_session(
145             self.manager.session_factory).client('cloudformation')
146 
147         def _tag_stacks(s):
148             client.update_stack(
149                 StackName=s['StackName'],
150                 UsePreviousTemplate=True,
151                 Tags=tags)
152 
153         with self.executor_factory(max_workers=2) as w:
154             list(w.map(_tag_stacks, stacks))
155 
156 
157 @CloudFormation.action_registry.register('remove-tag')
158 class CloudFormationRemoveTag(RemoveTag):
159     """Action to remove tags from a cloudformation stack
160 
161     :example:
162 
163     .. code-block: yaml
164 
165         policies:
166           - name: add-cfn-tag
167             resource: cfn
168             filters:
169               - 'tag:DesiredTag': present
170             actions:
171               - type: remove-tag
172                 tags: ['DesiredTag']
173     """
174 
175     def process_resource_set(self, stacks, keys):
176         client = local_session(
177             self.manager.session_factory).client('cloudformation')
178 
179         def _remove_tag(s):
180             tags = [t for t in s['Tags'] if t['Key'] not in keys]
181             client.update_stack(
182                 StackName=s['StackName'],
183                 UsePreviousTemplate=True,
184                 Tags=tags)
185 
186         with self.executor_factory(max_workers=2) as w:
187             list(w.map(_remove_tag, stacks))
188
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/c7n/resources/cfn.py b/c7n/resources/cfn.py
--- a/c7n/resources/cfn.py
+++ b/c7n/resources/cfn.py
@@ -145,9 +145,14 @@
             self.manager.session_factory).client('cloudformation')
 
         def _tag_stacks(s):
+            params = []
+            for p in s.get('Parameters', []):
+                params.append({'ParameterKey': p['ParameterKey'],
+                               'UsePreviousValue': True})
             client.update_stack(
                 StackName=s['StackName'],
                 UsePreviousTemplate=True,
+                Parameters=params,
                 Tags=tags)
 
         with self.executor_factory(max_workers=2) as w:

{"golden_diff": "diff --git a/c7n/resources/cfn.py b/c7n/resources/cfn.py\n--- a/c7n/resources/cfn.py\n+++ b/c7n/resources/cfn.py\n@@ -145,9 +145,14 @@\n             self.manager.session_factory).client('cloudformation')\n \n         def _tag_stacks(s):\n+            params = []\n+            for p in s.get('Parameters', []):\n+                params.append({'ParameterKey': p['ParameterKey'],\n+                               'UsePreviousValue': True})\n             client.update_stack(\n                 StackName=s['StackName'],\n                 UsePreviousTemplate=True,\n+                Parameters=params,\n                 Tags=tags)\n \n         with self.executor_factory(max_workers=2) as w:\n", "issue": "Tagging CloudFormation - Error: Parameters must have value\nInitially the stack is created with an input parameter.\r\n\r\n**c7n policy**\r\n```\r\npolicies:\r\n  - name: add-cfn-tag\r\n    resource: cfn\r\n    filters:\r\n      - \"tag:testcfn\": present\r\n    actions:\r\n      - type: tag\r\n        value: abc\r\n        key: BusinessUnit\r\n```\r\n**Error**\r\nAn error occurred (ValidationError) when calling the UpdateStack operation: Parameters: [input_param] must have values\n", "before_files": [{"content": "# Copyright 2015-2017 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport logging\n\nfrom concurrent.futures import as_completed\n\nfrom c7n.actions import BaseAction\nfrom c7n.manager import resources\nfrom c7n.query import QueryResourceManager\nfrom c7n.utils import local_session, type_schema\nfrom c7n.tags import RemoveTag, Tag\n\nlog = logging.getLogger('custodian.cfn')\n\n\n@resources.register('cfn')\nclass CloudFormation(QueryResourceManager):\n\n    class resource_type(object):\n        service = 'cloudformation'\n        type = 'stack'\n        enum_spec = ('describe_stacks', 'Stacks[]', None)\n        id = 'StackName'\n        filter_name = 'StackName'\n        filter_type = 'scalar'\n        name = 'StackName'\n        date = 'CreationTime'\n        dimension = None\n        config_type = 'AWS::CloudFormation::Stack'\n\n\n@CloudFormation.action_registry.register('delete')\nclass Delete(BaseAction):\n    \"\"\"Action to delete cloudformation stacks\n\n    It is recommended to use a filter to avoid unwanted deletion of stacks\n\n    :example:\n\n    .. code-block:: yaml\n\n            policies:\n              - name: cloudformation-delete-failed-stacks\n                resource: cfn\n                filters:\n                  - StackStatus: ROLLBACK_COMPLETE\n                actions:\n                  - delete\n    \"\"\"\n\n    schema = type_schema('delete')\n    permissions = (\"cloudformation:DeleteStack\",)\n\n    def process(self, stacks):\n        with self.executor_factory(max_workers=10) as w:\n            list(w.map(self.process_stacks, stacks))\n\n    def process_stacks(self, stack):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n        client.delete_stack(StackName=stack['StackName'])\n\n\n@CloudFormation.action_registry.register('set-protection')\nclass SetProtection(BaseAction):\n    \"\"\"Action to disable termination protection\n\n    It is recommended to use a filter to avoid unwanted deletion of stacks\n\n    :example:\n\n    .. code-block:: yaml\n\n            policies:\n              - name: cloudformation-disable-protection\n                resource: cfn\n                filters:\n                  - StackStatus: CREATE_COMPLETE\n                actions:\n                  - type: set-protection\n                    state: False\n    \"\"\"\n\n    schema = type_schema(\n        'set-protection', state={'type': 'boolean', 'default': False})\n\n    permissions = ('cloudformation:UpdateStack',)\n\n    def process(self, stacks):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n\n        with self.executor_factory(max_workers=3) as w:\n            futures = {}\n            for s in stacks:\n                futures[w.submit(self.process_stacks, client, s)] = s\n            for f in as_completed(futures):\n                s = futures[f]\n                if f.exception():\n                    self.log.error(\n                        \"Error updating protection stack:%s error:%s\",\n                        s['StackName'], f.exception())\n\n    def process_stacks(self, client, stack):\n        client.update_termination_protection(\n            EnableTerminationProtection=self.data.get('state', False),\n            StackName=stack['StackName'])\n\n\n@CloudFormation.action_registry.register('tag')\nclass CloudFormationAddTag(Tag):\n    \"\"\"Action to tag a cloudformation stack\n\n    :example:\n\n    .. code-block: yaml\n\n        policies:\n          - name: add-cfn-tag\n            resource: cfn\n            filters:\n              - 'tag:DesiredTag': absent\n            actions:\n              - type: tag\n                key: DesiredTag\n                value: DesiredValue\n    \"\"\"\n    permissions = ('cloudformation:UpdateStack',)\n\n    def process_resource_set(self, stacks, tags):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n\n        def _tag_stacks(s):\n            client.update_stack(\n                StackName=s['StackName'],\n                UsePreviousTemplate=True,\n                Tags=tags)\n\n        with self.executor_factory(max_workers=2) as w:\n            list(w.map(_tag_stacks, stacks))\n\n\n@CloudFormation.action_registry.register('remove-tag')\nclass CloudFormationRemoveTag(RemoveTag):\n    \"\"\"Action to remove tags from a cloudformation stack\n\n    :example:\n\n    .. code-block: yaml\n\n        policies:\n          - name: add-cfn-tag\n            resource: cfn\n            filters:\n              - 'tag:DesiredTag': present\n            actions:\n              - type: remove-tag\n                tags: ['DesiredTag']\n    \"\"\"\n\n    def process_resource_set(self, stacks, keys):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n\n        def _remove_tag(s):\n            tags = [t for t in s['Tags'] if t['Key'] not in keys]\n            client.update_stack(\n                StackName=s['StackName'],\n                UsePreviousTemplate=True,\n                Tags=tags)\n\n        with self.executor_factory(max_workers=2) as w:\n            list(w.map(_remove_tag, stacks))\n", "path": "c7n/resources/cfn.py"}], "after_files": [{"content": "# Copyright 2015-2017 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport logging\n\nfrom concurrent.futures import as_completed\n\nfrom c7n.actions import BaseAction\nfrom c7n.manager import resources\nfrom c7n.query import QueryResourceManager\nfrom c7n.utils import local_session, type_schema\nfrom c7n.tags import RemoveTag, Tag\n\nlog = logging.getLogger('custodian.cfn')\n\n\n@resources.register('cfn')\nclass CloudFormation(QueryResourceManager):\n\n    class resource_type(object):\n        service = 'cloudformation'\n        type = 'stack'\n        enum_spec = ('describe_stacks', 'Stacks[]', None)\n        id = 'StackName'\n        filter_name = 'StackName'\n        filter_type = 'scalar'\n        name = 'StackName'\n        date = 'CreationTime'\n        dimension = None\n        config_type = 'AWS::CloudFormation::Stack'\n\n\n@CloudFormation.action_registry.register('delete')\nclass Delete(BaseAction):\n    \"\"\"Action to delete cloudformation stacks\n\n    It is recommended to use a filter to avoid unwanted deletion of stacks\n\n    :example:\n\n    .. code-block:: yaml\n\n            policies:\n              - name: cloudformation-delete-failed-stacks\n                resource: cfn\n                filters:\n                  - StackStatus: ROLLBACK_COMPLETE\n                actions:\n                  - delete\n    \"\"\"\n\n    schema = type_schema('delete')\n    permissions = (\"cloudformation:DeleteStack\",)\n\n    def process(self, stacks):\n        with self.executor_factory(max_workers=10) as w:\n            list(w.map(self.process_stacks, stacks))\n\n    def process_stacks(self, stack):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n        client.delete_stack(StackName=stack['StackName'])\n\n\n@CloudFormation.action_registry.register('set-protection')\nclass SetProtection(BaseAction):\n    \"\"\"Action to disable termination protection\n\n    It is recommended to use a filter to avoid unwanted deletion of stacks\n\n    :example:\n\n    .. code-block:: yaml\n\n            policies:\n              - name: cloudformation-disable-protection\n                resource: cfn\n                filters:\n                  - StackStatus: CREATE_COMPLETE\n                actions:\n                  - type: set-protection\n                    state: False\n    \"\"\"\n\n    schema = type_schema(\n        'set-protection', state={'type': 'boolean', 'default': False})\n\n    permissions = ('cloudformation:UpdateStack',)\n\n    def process(self, stacks):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n\n        with self.executor_factory(max_workers=3) as w:\n            futures = {}\n            for s in stacks:\n                futures[w.submit(self.process_stacks, client, s)] = s\n            for f in as_completed(futures):\n                s = futures[f]\n                if f.exception():\n                    self.log.error(\n                        \"Error updating protection stack:%s error:%s\",\n                        s['StackName'], f.exception())\n\n    def process_stacks(self, client, stack):\n        client.update_termination_protection(\n            EnableTerminationProtection=self.data.get('state', False),\n            StackName=stack['StackName'])\n\n\n@CloudFormation.action_registry.register('tag')\nclass CloudFormationAddTag(Tag):\n    \"\"\"Action to tag a cloudformation stack\n\n    :example:\n\n    .. code-block: yaml\n\n        policies:\n          - name: add-cfn-tag\n            resource: cfn\n            filters:\n              - 'tag:DesiredTag': absent\n            actions:\n              - type: tag\n                key: DesiredTag\n                value: DesiredValue\n    \"\"\"\n    permissions = ('cloudformation:UpdateStack',)\n\n    def process_resource_set(self, stacks, tags):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n\n        def _tag_stacks(s):\n            params = []\n            for p in s.get('Parameters', []):\n                params.append({'ParameterKey': p['ParameterKey'],\n                               'UsePreviousValue': True})\n            client.update_stack(\n                StackName=s['StackName'],\n                UsePreviousTemplate=True,\n                Parameters=params,\n                Tags=tags)\n\n        with self.executor_factory(max_workers=2) as w:\n            list(w.map(_tag_stacks, stacks))\n\n\n@CloudFormation.action_registry.register('remove-tag')\nclass CloudFormationRemoveTag(RemoveTag):\n    \"\"\"Action to remove tags from a cloudformation stack\n\n    :example:\n\n    .. code-block: yaml\n\n        policies:\n          - name: add-cfn-tag\n            resource: cfn\n            filters:\n              - 'tag:DesiredTag': present\n            actions:\n              - type: remove-tag\n                tags: ['DesiredTag']\n    \"\"\"\n\n    def process_resource_set(self, stacks, keys):\n        client = local_session(\n            self.manager.session_factory).client('cloudformation')\n\n        def _remove_tag(s):\n            tags = [t for t in s['Tags'] if t['Key'] not in keys]\n            client.update_stack(\n                StackName=s['StackName'],\n                UsePreviousTemplate=True,\n                Tags=tags)\n\n        with self.executor_factory(max_workers=2) as w:\n            list(w.map(_remove_tag, stacks))\n", "path": "c7n/resources/cfn.py"}]}