-
Notifications
You must be signed in to change notification settings - Fork 398
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
Issue/Feature #1573 Add support for tags in aws_ssm_parameter_store module #1574
Issue/Feature #1573 Add support for tags in aws_ssm_parameter_store module #1574
Conversation
…m_parameter_store module
Docs Build 📝Thank you for contribution!✨ The docsite for this PR is available for download as an artifact from this run: You can compare to the docs for the File changes:
Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/ssm_parameter_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/ssm_parameter_module.html
index 5f74294..809406a 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/ssm_parameter_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/ssm_parameter_module.html
@@ -291,6 +291,20 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
</div></td>
</tr>
<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-purge_tags"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-parameter-purge-tags"><strong>purge_tags</strong></p>
+<a class="ansibleOptionLink" href="#parameter-purge_tags" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>If <em>purge_tags=true</em> and <em>tags</em> is set, existing tags will be purged from the resource to match exactly what is defined by <em>tags</em> parameter.</p>
+<p>If the <em>tags</em> parameter is not set then tags will not be modified, even if <em>purge_tags=True</em>.</p>
+<p>Tag keys beginning with <code class="docutils literal notranslate"><span class="pre">aws:</span></code> are reserved by Amazon and can not be modified. As such they will be ignored for the purposes of the <em>purge_tags</em> parameter. See the Amazon documentation for more information <a class="reference external" href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html#tag-conventions">https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html#tag-conventions</a>.</p>
+<p class="ansible-option-line"><span class="ansible-option-choices">Choices:</span></p>
+<ul class="simple">
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><span class="pre">true</span></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-region"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_region"></div>
<div class="ansibleOptionAnchor" id="parameter-ec2_region"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-parameter-region"><span id="ansible-collections-community-aws-ssm-parameter-module-parameter-ec2-region"></span><span id="ansible-collections-community-aws-ssm-parameter-module-parameter-aws-region"></span><strong>region</strong></p>
@@ -305,7 +319,7 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
<p>Support for the <code class="docutils literal notranslate"><span class="pre">EC2_REGION</span></code> environment variable has been deprecated and will be removed in a release after 2024-12-01.</p>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-secret_key"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_secret_access_key"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_secret_key"></div>
@@ -322,7 +336,7 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
<p>Support for the <code class="docutils literal notranslate"><span class="pre">EC2_SECRET_KEY</span></code> environment variable has been deprecated and will be removed in a release after 2024-12-01.</p>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-session_token"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_session_token"></div>
<div class="ansibleOptionAnchor" id="parameter-security_token"></div>
@@ -340,7 +354,7 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
<p>Support for the <code class="docutils literal notranslate"><span class="pre">EC2_SECRET_KEY</span></code> and <code class="docutils literal notranslate"><span class="pre">AWS_SECURITY_TOKEN</span></code> environment variables has been deprecated and will be removed in a release after 2024-12-01.</p>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-state"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-parameter-state"><strong>state</strong></p>
<a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
</div></td>
@@ -353,7 +367,7 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
</ul>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-string_type"></div>
<div class="ansibleOptionAnchor" id="parameter-type"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-parameter-type"><span id="ansible-collections-community-aws-ssm-parameter-module-parameter-string-type"></span><strong>string_type</strong></p>
<a class="ansibleOptionLink" href="#parameter-string_type" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: type</span></p>
@@ -368,6 +382,16 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
</ul>
</div></td>
</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-tags"></div>
+<div class="ansibleOptionAnchor" id="parameter-resource_tags"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-parameter-tags"><span id="ansible-collections-community-aws-ssm-parameter-module-parameter-resource-tags"></span><strong>tags</strong></p>
+<a class="ansibleOptionLink" href="#parameter-tags" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: resource_tags</span></p>
+<p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>A dictionary representing the tags to be applied to the resource.</p>
+<p>If the <em>tags</em> parameter is not set then tags will not be modified.</p>
+</div></td>
+</tr>
<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-tier"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-parameter-tier"><strong>tier</strong></p>
<a class="ansibleOptionLink" href="#parameter-tier" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
@@ -471,6 +495,29 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">recommend to use with aws_ssm lookup plugin</span><span class="w"></span>
<span class="w"> </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"></span>
<span class="w"> </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">"</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">'amazon.aws.aws_ssm'</span><span class="o">,</span> <span class="s1">'Hello'</span><span class="o">)</span> <span class="cp">}}</span><span class="s">"</span><span class="w"></span>
+
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Create or update key/value pair in AWS SSM parameter store w/ tags</span><span class="w"></span>
+<span class="w"> </span><span class="nt">community.aws.ssm_paramater</span><span class="p">:</span><span class="w"></span>
+<span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Hello"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">description</span><span class="p">:</span><span class="w"> </span><span class="s">"This</span><span class="nv"> </span><span class="s">is</span><span class="nv"> </span><span class="s">your</span><span class="nv"> </span><span class="s">first</span><span class="nv"> </span><span class="s">key"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">value</span><span class="p">:</span><span class="w"> </span><span class="s">"World"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">tags</span><span class="p">:</span><span class="w"></span>
+<span class="w"> </span><span class="nt">Environment</span><span class="p">:</span><span class="w"> </span><span class="s">"dev"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">Version</span><span class="p">:</span><span class="w"> </span><span class="s">"1.0"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">Confidentiality</span><span class="p">:</span><span class="w"> </span><span class="s">"low"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">Tag With Space</span><span class="p">:</span><span class="w"> </span><span class="s">"foo</span><span class="nv"> </span><span class="s">bar"</span><span class="w"></span>
+
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Add or update a tag on an existing parameter w/o removing existing tags</span><span class="w"></span>
+<span class="w"> </span><span class="nt">community.aws.ssm_paramater</span><span class="p">:</span><span class="w"></span>
+<span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Hello"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">purge_tags</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span><span class="w"></span>
+<span class="w"> </span><span class="nt">tags</span><span class="p">:</span><span class="w"></span>
+<span class="w"> </span><span class="nt">Contact</span><span class="p">:</span><span class="w"> </span><span class="s">"person1"</span><span class="w"></span>
+
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Delete all tags on an existing parameter</span><span class="w"></span>
+<span class="w"> </span><span class="nt">community.aws.ssm_paramater</span><span class="p">:</span><span class="w"></span>
+<span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Hello"</span><span class="w"></span>
+<span class="w"> </span><span class="nt">tags</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{}</span><span class="w"></span>
</pre></div>
</div>
</section>
@@ -573,6 +620,41 @@ see <a class="reference internal" href="#ansible-collections-community-aws-ssm-p
</div></td>
</tr>
<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="return-parameter_metadata/tags"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-return-parameter-metadata-tags"><strong>tags</strong></p>
+<a class="ansibleOptionLink" href="#return-parameter_metadata/tags" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=dictionary</span></p>
+</div></td>
+<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>A list of dictionaries representing the tags associated with the parameter in the standard boto3 format.</p>
+<p class="ansible-option-line"><span class="ansible-option-returned-bold">Returned:</span> when the parameter has tags</p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="return-parameter_metadata/tags/key"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-return-parameter-metadata-tags-key"><strong>key</strong></p>
+<a class="ansibleOptionLink" href="#return-parameter_metadata/tags/key" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+</div></td>
+<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The name or key of the tag.</p>
+<p class="ansible-option-line"><span class="ansible-option-returned-bold">Returned:</span> success</p>
+<p class="ansible-option-line ansible-option-sample"><span class="ansible-option-sample-bold">Sample:</span> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">"MyTag"</span></code></p>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="return-parameter_metadata/tags/value"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-return-parameter-metadata-tags-value"><strong>value</strong></p>
+<a class="ansibleOptionLink" href="#return-parameter_metadata/tags/value" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+</div></td>
+<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The value of the tag.</p>
+<p class="ansible-option-line"><span class="ansible-option-returned-bold">Returned:</span> success</p>
+<p class="ansible-option-line ansible-option-sample"><span class="ansible-option-sample-bold">Sample:</span> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">"Some</span> <span class="pre">value."</span></code></p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="return-parameter_metadata/tags_dict"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-return-parameter-metadata-tags-dict"><strong>tags_dict</strong></p>
+<a class="ansibleOptionLink" href="#return-parameter_metadata/tags_dict" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
+</div></td>
+<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>A dictionary representing the tags associated with the parameter.</p>
+<p class="ansible-option-line"><span class="ansible-option-returned-bold">Returned:</span> when the parameter has tags</p>
+<p class="ansible-option-line ansible-option-sample"><span class="ansible-option-sample-bold">Sample:</span> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">{"MyTagName":</span> <span class="pre">"Some</span> <span class="pre">Value"}</span></code></p>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="return-parameter_metadata/tier"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ssm-parameter-module-return-parameter-metadata-tier"><strong>tier</strong></p>
<a class="ansibleOptionLink" href="#return-parameter_metadata/tier" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
</div></td>
|
recheck |
… tags as a on-off
6e8ab4f
to
3a673fe
Compare
…le-collections#1578) Remove unrelated snapshot comment from rds_instance state docs SUMMARY The state field for rds_instance mentions snapshots. But that's irrelevant. Probably an error when copy-pasting to create the module. Fixes ansible-collections#1574 ISSUE TYPE Docs Pull Request COMPONENT NAME rds_instance Reviewed-by: Mark Chappell
SUMMARY
Feature request #1573 - Adds support for adding/removing/updating tags in aws_ssm_parameter_store module.
ISSUE TYPE
COMPONENT NAME
ssm_parameter
ADDITIONAL INFORMATION
This PR adds support for tagging AWS SSM Parameters. The secretsmanager_secret was used as a model along with the EC2 tag helper functions. Integration tests are included to cover different tagging scenarios.