This module makes it easy to deploy a single server--that is, a single EC2 instance (e.g. a bastion host, Jenkins
server) rather than an Auto Scaling Group or ECS Cluster--along with the all the resources it typically needs:
The EC2 instance itself.
An Elastic IP (EIP) address.
An optional DNS record pointing at the EIP.
IAM Role and IAM instance profile.
Security group.
How do you use this module?
See the root README for instructions on using Terraform modules.
public_ip: The public IP address of the server (via its EIP)
fqdn: The fully-qualified domain name of the server (e.g. jenkins.example.com) if you set the dns_zone_id and
dns_name variables.
Can I BYOSG (bring your own security groups)?
In some cases, it's desirable to have the ability to assign your own externally managed security groups. To do this,
set the additional_security_group_ids variable with the desired security group id(s). This list of security groups
will be combined with the default security group.
Note: if you set default_network_interface_id to override the default network interface, AWS does not allow attaching
any security groups to the EC2 instance, so you will need to attach any and all security groups you need to the network
interface you pass in.
What if I just want to add custom security group rules to the default security group?
One of the other important outputs of this module is the security_group_id, which is the id of the server's default
Security Group. You can add custom rules to this Security Group using the aws_security_group_rule resource:
This module creates an IAM role for your EC2 instance and exports the id of that role as the output iam_role_id. You
can attach custom policies to this IAM role using the aws_iam_policy_attachment resource:
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"6b92fa9268353569fdd9f050d92838db8c06f816"},{"name":"post-upgrade-test-results.sh","path":".circleci/post-upgrade-test-results.sh","sha":"a4867e8fbdc334b7a90259568ee41ea577fbe764"},{"name":"set-upgrade-test-vars.sh","path":".circleci/set-upgrade-test-vars.sh","sha":"f223143a4a4b6653c7f0d9817364c410945b5bde"}]},{"name":".github","children":[{"name":"ISSUE_TEMPLATE","children":[{"name":"bug_report.md","path":".github/ISSUE_TEMPLATE/bug_report.md","sha":"d2e87e27c601e423865ed660ec697082470ca60f"},{"name":"feature_request.md","path":".github/ISSUE_TEMPLATE/feature_request.md","sha":"023a33099be2336476930c96e17ff1ba5dc55348"}]},{"name":"pull_request_template.md","path":".github/pull_request_template.md","sha":"6b100e40e323b5b07f40ed30616277c51c9f4b9e"}]},{"name":".gitignore","path":".gitignore","sha":"1b77db107bd9abb565bd5adafce570dd59adf016"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"6c5b735f0db5a0b8d732e9fc612255e3f181d7d5"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"f57844eeef3b0fe197ef48e443834a06baf91d28"},{"name":"LICENSE.txt","path":"LICENSE.txt","sha":"f4e3d9bd4717a044ed31ad847a300eee74371a78"},{"name":"README.adoc","path":"README.adoc","sha":"65a8d37206bb86a091fdbb58b59492e2e45e3805"},{"name":"_docs","children":[{"name":"aws-ec2.png","path":"_docs/aws-ec2.png","sha":"861e17a7d1df585b37d10e3211f71f6a6e182115"},{"name":"single-ec2-instance-architecture.png","path":"_docs/single-ec2-instance-architecture.png","sha":"c44f7efdb936c53fc4988f286ddcf31be8a6fdc9"}]},{"name":"core-concepts.md","path":"core-concepts.md","sha":"2e184e97784600b3c64345559cec828baebf71f9"},{"name":"examples","children":[{"name":"attach-eni","children":[{"name":"README.md","path":"examples/attach-eni/README.md","sha":"8af05ff614cd9330635dcfb2e4364e8ddcdc1418"},{"name":"main.tf","path":"examples/attach-eni/main.tf","sha":"4fa734efe5515ae3cef244d6e0c1b901e8adfe3b"},{"name":"outputs.tf","path":"examples/attach-eni/outputs.tf","sha":"1cd6ad4b2aa0a56a16203589a2f19ee0ab2117de"},{"name":"packer","children":[{"name":"build.pkr.hcl","path":"examples/attach-eni/packer/build.pkr.hcl","sha":"f76fa391a6a5c1df8699e8d2f2f8f98d7cc871f2"}]},{"name":"user-data","children":[{"name":"user-data-1.sh","path":"examples/attach-eni/user-data/user-data-1.sh","sha":"270432275db472b6cd3a84b1d0d1e661914727e6"},{"name":"user-data-2.sh","path":"examples/attach-eni/user-data/user-data-2.sh","sha":"ec638362d287eba3912efe647d296ac8b0e9a177"}]},{"name":"variables.tf","path":"examples/attach-eni/variables.tf","sha":"729680fb75f8962c03f5530e4162e2df63345434"}]},{"name":"bastion-host","children":[{"name":"README.md","path":"examples/bastion-host/README.md","sha":"8d42b76ced130f2a046869af393203069a8c6ce4"},{"name":"main.tf","path":"examples/bastion-host/main.tf","sha":"ac9060610f30d24e80b28136c6f18eb5b4d55279"},{"name":"outputs.tf","path":"examples/bastion-host/outputs.tf","sha":"5f0c2d739b9646c39e19bfd05cacb852c6080c0c"},{"name":"user-data.sh","path":"examples/bastion-host/user-data.sh","sha":"40484d6463cf88d4d5b174cbc3ca759548b9d788"},{"name":"variables.tf","path":"examples/bastion-host/variables.tf","sha":"4d505a6e737712acccbdc710a1059033009725e6"}]},{"name":"ec2-backup","children":[{"name":"README.md","path":"examples/ec2-backup/README.md","sha":"782667373dc4d7cf602fea0e05d6b78ed47d2c42"},{"name":"main.tf","path":"examples/ec2-backup/main.tf","sha":"71c9de93c49b7b26e89756c426b6383286eec2c8"},{"name":"outputs.tf","path":"examples/ec2-backup/outputs.tf","sha":"6023311f87f6757e60e5d47600095cbc6dce324a"},{"name":"variables.tf","path":"examples/ec2-backup/variables.tf","sha":"e6e9fa9520608ef0a5cc0aadc70d118775543b03"}]},{"name":"ec2-instance-on-dedicated-host","children":[{"name":"README.md","path":"examples/ec2-instance-on-dedicated-host/README.md","sha":"b806952a5dd8f8ce81290e088c2971d2bffea814"},{"name":"main.tf","path":"examples/ec2-instance-on-dedicated-host/main.tf","sha":"ab28789d1f464895b72722c2ac92181f18e40a1c"},{"name":"variables.tf","path":"examples/ec2-instance-on-dedicated-host/variables.tf","sha":"94f2883ec78b1d52f350b59c17f63fc2d7096a60"}]},{"name":"ec2-instance-with-custom-iam-role","children":[{"name":"README.md","path":"examples/ec2-instance-with-custom-iam-role/README.md","sha":"c55193f734cec595162ecd6b80fc79563bb06ab1"},{"name":"main.tf","path":"examples/ec2-instance-with-custom-iam-role/main.tf","sha":"e31f653c0886028ea8515506d6f7d1bf20b13472"},{"name":"variables.tf","path":"examples/ec2-instance-with-custom-iam-role/variables.tf","sha":"729d4d107700c91ce9bf3957dbf4781b7b477f0a"}]},{"name":"override-default-eni","children":[{"name":"README.md","path":"examples/override-default-eni/README.md","sha":"1793e4fc9adf7d9fd7e8fd850f725333590fd761"},{"name":"main.tf","path":"examples/override-default-eni/main.tf","sha":"18f1a2ed568bce3d85f86d00791daca755b42eed"},{"name":"outputs.tf","path":"examples/override-default-eni/outputs.tf","sha":"58332f65c35948f297b649e14ae2d398c084837f"},{"name":"variables.tf","path":"examples/override-default-eni/variables.tf","sha":"d806a01b3f9919283060378a17026db6a5425d81"}]},{"name":"persistent-ebs-volume","children":[{"name":"README.md","path":"examples/persistent-ebs-volume/README.md","sha":"86e01a93a843b5498157d96b44f34eba2ec91b0d"},{"name":"main.tf","path":"examples/persistent-ebs-volume/main.tf","sha":"3ff0402f0430e58cd96225e71b465866413340b1"},{"name":"outputs.tf","path":"examples/persistent-ebs-volume/outputs.tf","sha":"54f33c96b796373b12b9702f46d30a1c85043f65"},{"name":"packer","children":[{"name":"build.pkr.hcl","path":"examples/persistent-ebs-volume/packer/build.pkr.hcl","sha":"321e8c08e1a045e60fea31b2fb51cfa950a7a96f"}]},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/persistent-ebs-volume/user-data/user-data.sh","sha":"9c5d08f440596a978418d09aea275d8c0ffc16fb"}]},{"name":"variables.tf","path":"examples/persistent-ebs-volume/variables.tf","sha":"96cc0689e82ce10128c70f1dafad5c34cc173bc2"}]},{"name":"route53-helpers","children":[{"name":"README.md","path":"examples/route53-helpers/README.md","sha":"0aee10984ea4e5426d1e000ebaa235eb8e7ca15b"},{"name":"main.tf","path":"examples/route53-helpers/main.tf","sha":"c224666fc92e8a656aa70235421513858662fa2e"},{"name":"outputs.tf","path":"examples/route53-helpers/outputs.tf","sha":"4c3c3ccccf964155ffbce7546fcbc9ef6e886de6"},{"name":"packer","children":[{"name":"build.pkr.hcl","path":"examples/route53-helpers/packer/build.pkr.hcl","sha":"4b0e2203595650f334c95a979ff8ae330d1fbb15"}]},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/route53-helpers/user-data/user-data.sh","sha":"fcd5070b46e6428d81dbb1e5ba5f4bef3b5b8c0c"}]},{"name":"variables.tf","path":"examples/route53-helpers/variables.tf","sha":"2df92a355955f27e81e1aed8a1306c0bbb1a49f1"}]},{"name":"simple-server","children":[{"name":"README.md","path":"examples/simple-server/README.md","sha":"de31cd49735376d18f52a4a4a9a4588c9d13afac"},{"name":"main.tf","path":"examples/simple-server/main.tf","sha":"61d7624e42023cd7f44a8ea24f8ccca3950c2be0"},{"name":"outputs.tf","path":"examples/simple-server/outputs.tf","sha":"54636d69ec91b8f2a787ba6c6963ec7285bda735"},{"name":"user-data.sh","path":"examples/simple-server/user-data.sh","sha":"0e411aae1513610ca785acb3b5afde93e639d9fc"},{"name":"variables.tf","path":"examples/simple-server/variables.tf","sha":"0d36d5040aeebf8602fff9629ba5f05ec10888a4"}]}]},{"name":"modules","children":[{"name":"attach-eni","children":[{"name":"README.md","path":"modules/attach-eni/README.md","sha":"d300c61ab08d811abd5647a4bd95689be67c66ca"},{"name":"bin","children":[{"name":"attach-eni","path":"modules/attach-eni/bin/attach-eni","sha":"dd7412195755b86e7392e0ea4f41b9af6dd2e95d"}]},{"name":"install.sh","path":"modules/attach-eni/install.sh","sha":"542cbd93ca08fd9cbe6f121f4d8fea2b1d76ca8b"}]},{"name":"disable-instance-metadata","children":[{"name":"README.md","path":"modules/disable-instance-metadata/README.md","sha":"eacec50007d78aec20335d85b05a9582200c9a66"},{"name":"bin","children":[{"name":"disable-instance-metadata","path":"modules/disable-instance-metadata/bin/disable-instance-metadata","sha":"a2b5e85b40225bc693a46978dd2ca2ea9406283f"}]},{"name":"install.sh","path":"modules/disable-instance-metadata/install.sh","sha":"bdce5d29adc4041375ffc9bf7eabb93a0059583c"}]},{"name":"ec2-backup","children":[{"name":"README.md","path":"modules/ec2-backup/README.md","sha":"e5f22ab6bdd9f34dacf71428bc04fef1d5415bad"},{"name":"main.tf","path":"modules/ec2-backup/main.tf","sha":"61d55c083546643fcd25188a316e27778ff71389"},{"name":"outputs.tf","path":"modules/ec2-backup/outputs.tf","sha":"19b7bd464c3c0916e03bff6f4f2cf69b671041ed"},{"name":"variables.tf","path":"modules/ec2-backup/variables.tf","sha":"82e2457bc5a01ab1f8bbe52a00902d0993124f75"}]},{"name":"persistent-ebs-volume","children":[{"name":"README.md","path":"modules/persistent-ebs-volume/README.md","sha":"7c9ea421cab052038900eb0f406c971c44ff335a"},{"name":"bin","children":[{"name":"mount-ebs-volume","path":"modules/persistent-ebs-volume/bin/mount-ebs-volume","sha":"faee5e21fc59560f76dddc1e6a3bc694e9214e8b"},{"name":"unmount-ebs-volume","path":"modules/persistent-ebs-volume/bin/unmount-ebs-volume","sha":"cd0103907161ebab9ef5d95cc4f2ad73dcf3671c"}]},{"name":"install.sh","path":"modules/persistent-ebs-volume/install.sh","sha":"e0ce5862cd6975992dc011a6dfe94fdf14a9b607"}]},{"name":"require-instance-metadata-service-version","children":[{"name":"README.md","path":"modules/require-instance-metadata-service-version/README.md","sha":"e44bae312f899c7b88cb7745e0732cf71f28fe8e"},{"name":"bin","children":[{"name":"require-instance-metadata-service-version","path":"modules/require-instance-metadata-service-version/bin/require-instance-metadata-service-version","sha":"49481dbbd668025409ae6e9fa7903276f3145948"}]},{"name":"install.sh","path":"modules/require-instance-metadata-service-version/install.sh","sha":"b819422b6cd7475666945112202fb71adbc6bb60"}]},{"name":"route53-helpers","children":[{"name":"README.md","path":"modules/route53-helpers/README.md","sha":"52d0b942bba658065589567e9c9d78c98b4ca028"},{"name":"bin","children":[{"name":"add-dns-a-record","path":"modules/route53-helpers/bin/add-dns-a-record","sha":"2fd418252934a48c78f910a739b5d681d1585941"}]},{"name":"install.sh","path":"modules/route53-helpers/install.sh","sha":"535ed35d64611c5f12e9924b3cb8df0a77180ab8"}]},{"name":"single-server","children":[{"name":"README.md","path":"modules/single-server/README.md","sha":"b3c4c20bdacd23061c068e159db70190b8c11f76","toggled":true},{"name":"main.tf","path":"modules/single-server/main.tf","sha":"3b8da34b20390222572950b13bd7c6e9a6d41889"},{"name":"outputs.tf","path":"modules/single-server/outputs.tf","sha":"0b43a44ea00862a8cf386da69e3645c57f3f24fa"},{"name":"variables.tf","path":"modules/single-server/variables.tf","sha":"132c36be976d6d2294dd16071b41bea424cb9d26"}],"toggled":true}],"toggled":true},{"name":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","path":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","sha":"ae586c0fe830819580e1009d41a9074f16e65bed"},{"name":"test","children":[{"name":"README.md","path":"test/README.md","sha":"535b2717ac8c2d1bf416a66188df08106bdd1f57"},{"name":"bastion","children":[{"name":"bastion_host_test.go","path":"test/bastion/bastion_host_test.go","sha":"6bd2b91ea8c445712cc501e39197fcbfe64670a0"}]},{"name":"ec2","children":[{"name":"ec2_backup_test.go","path":"test/ec2/ec2_backup_test.go","sha":"f4864f133d2bb2b7ca12c97d6610f5e6f8aaed60"},{"name":"ec2_custom_iam_role_test.go","path":"test/ec2/ec2_custom_iam_role_test.go","sha":"02f12141dba641d4b899ed66ebac7045084b2715"},{"name":"ec2_dedicated_host_test.go","path":"test/ec2/ec2_dedicated_host_test.go","sha":"1ad1abe5c6ad6531d9cac0b3621ee67b22f6ce9d"}]},{"name":"eni","children":[{"name":"attach_eni_test.go","path":"test/eni/attach_eni_test.go","sha":"34cabdfd57303167d981b06a00f321ab7281145f"},{"name":"override_default_eni_test.go","path":"test/eni/override_default_eni_test.go","sha":"fdf975db49cdf7ec0b34f9b0aa909a509077ed83"}]},{"name":"go.mod","path":"test/go.mod","sha":"e73ae754bb9a710ced6896e484111438be20ec27"},{"name":"go.sum","path":"test/go.sum","sha":"6cad57493fbfeb810f70565c098000b5d81ca797"},{"name":"persistent_ebs","children":[{"name":"persistent_ebs_volume_test.go","path":"test/persistent_ebs/persistent_ebs_volume_test.go","sha":"b96186ebb9ba418662e66d799e714486c513a3e1"}]},{"name":"route53","children":[{"name":"route53_helpers_test.go","path":"test/route53/route53_helpers_test.go","sha":"00c656316aa84876776cb43b79833c82dd5271e9"}]},{"name":"simple-server","children":[{"name":"simple_server_host_test.go","path":"test/simple-server/simple_server_host_test.go","sha":"3b2ac545c567de4fa2a9d95765aa5910cc6768b3"}]},{"name":"test_helpers.go","path":"test/test_helpers.go","sha":"e936e3804ae84f7af8b04b8e0c345903b148e4a4"},{"name":"upgrades","children":[{"name":"upgrade_test.go","path":"test/upgrades/upgrade_test.go","sha":"4fe369f1de1716af85440932577256f705439636"}]},{"name":"validation","children":[{"name":"validate_all_modules_and_examples_test.go","path":"test/validation/validate_all_modules_and_examples_test.go","sha":"33d73c385b64c4fc870033e99427e683c31dc45a"}]}]}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"single-server-module\">Single Server Module</h1><div class=\"preview__body--border\"></div><p>This module makes it easy to deploy a single server--that is, a single EC2 instance (e.g. a bastion host, Jenkins\nserver) rather than an Auto Scaling Group or ECS Cluster--along with the all the resources it typically needs:</p>\n<ol>\n<li>The EC2 instance itself.</li>\n<li>An Elastic IP (EIP) address.</li>\n<li>An optional DNS record pointing at the EIP.</li>\n<li>IAM Role and IAM instance profile.</li>\n<li>Security group.</li>\n</ol>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-use-this-module\">How do you use this module?</h2>\n<ul>\n<li>See the <a href=\"/repos/v0.15.13/module-server/README.adoc\" class=\"preview__body--description--blue\">root README</a> for instructions on using Terraform modules.</li>\n<li>See the <a href=\"/repos/v0.15.13/module-server/examples\" class=\"preview__body--description--blue\">examples</a> folder for example usage.</li>\n<li>See <a href=\"/repos/v0.15.13/module-server/modules/single-server/variables.tf\" class=\"preview__body--description--blue\">variables.tf</a> for all the variables you can set on this module.</li>\n</ul>\n<p>Here is an example of how you might deploy a single Jenkins server with this module:</p>\n<pre><span class=\"hljs-keyword\">module</span> <span class=\"hljs-string\">\"jenkins\"</span> {\n source = <span class=\"hljs-string\">\"git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.0.40\"</span>\n\n name = <span class=\"hljs-string\">\"jenkins\"</span>\n ami = <span class=\"hljs-string\">\"ami-123456\"</span>\n instance_type = <span class=\"hljs-string\">\"t2.medium\"</span>\n keypair_name = <span class=\"hljs-string\">\"jenkins-keypair\"</span>\n user_data = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${var.user_data}</span>\"</span>\n\n vpc_id = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${var.vpc_id}</span>\"</span>\n subnet_id = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${var.subnet_id}</span>\"</span>\n}\n</pre>\n<p>If you already have a <a href=\"http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/AboutHostedZones.html\" class=\"preview__body--description--blue\" target=\"_blank\">Route 53 Hosted Zone</a>\nsuch as example.com, you could run this instance on jenkins.example.com by adding two more parameters:</p>\n<pre><span class=\"hljs-comment\"># The id of the example.com hosted zone</span>\ndns_zone_id = <span class=\"hljs-string\">\"ABC12345\"</span>\n\n<span class=\"hljs-comment\"># The new DNS name to add</span>\ndns_name = <span class=\"hljs-string\">\"jenkins.example.com\"</span>\n</pre>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-i-see-the-server\">How do I see the server?</h2>\n<p>This module includes several <a href=\"https://www.terraform.io/intro/getting-started/outputs.html\" class=\"preview__body--description--blue\" target=\"_blank\">Terraform outputs</a>,\nincluding:</p>\n<ol>\n<li><code>public_ip</code>: The public IP address of the server (via its EIP)</li>\n<li><code>fqdn</code>: The fully-qualified domain name of the server (e.g. jenkins.example.com) if you set the <code>dns_zone_id</code> and\n<code>dns_name</code> variables.</li>\n</ol>\n<h2 class=\"preview__body--subtitle\" id=\"can-i-byosg-bring-your-own-security-groups\">Can I BYOSG (bring your own security groups)?</h2>\n<p>In some cases, it's desirable to have the ability to assign your own externally managed security groups. To do this,\nset the <code>additional_security_group_ids</code> variable with the desired security group id(s). This list of security groups\nwill be combined with the default security group.</p>\n<p>Note: if you set <code>default_network_interface_id</code> to override the default network interface, AWS does not allow attaching\nany security groups to the EC2 instance, so you will need to attach any and all security groups you need to the network\ninterface you pass in.</p>\n<h2 class=\"preview__body--subtitle\" id=\"what-if-i-just-want-to-add-custom-security-group-rules-to-the-default-security-group\">What if I just want to add custom security group rules to the default security group?</h2>\n<p>One of the other important outputs of this module is the <code>security_group_id</code>, which is the id of the server's default\nSecurity Group. You can add custom rules to this Security Group using the <code>aws_security_group_rule</code> resource:</p>\n<pre><span class=\"hljs-keyword\">module</span> <span class=\"hljs-string\">\"jenkins\"</span> {\n source = <span class=\"hljs-string\">\"git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.0.40\"</span>\n\n <span class=\"hljs-comment\"># (... options omitted...)</span>\n}\n\n<span class=\"hljs-comment\"># Custom rule to allow inbound HTTPS traffic from anywhere</span>\n<span class=\"hljs-keyword\">resource</span> <span class=\"hljs-string\">\"aws_security_group_rule\"</span> <span class=\"hljs-string\">\"allow_inbound_https_all\"</span> {\n type = <span class=\"hljs-string\">\"ingress\"</span>\n from_port = <span class=\"hljs-number\">443</span>\n to_port = <span class=\"hljs-number\">443</span>\n protocol = <span class=\"hljs-string\">\"tcp\"</span>\n cidr_blocks = [<span class=\"hljs-string\">\"0.0.0.0/0\"</span>]\n security_group_id = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${module.jenkins.security_group_id}</span>\"</span>\n}\n</pre>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-i-add-a-custom-iam-policy\">How do I add a custom IAM policy?</h2>\n<p>This module creates an IAM role for your EC2 instance and exports the id of that role as the output <code>iam_role_id</code>. You\ncan attach custom policies to this IAM role using the <code>aws_iam_policy_attachment</code> resource:</p>\n<pre>module <span class=\"hljs-string\">\"jenkins\"</span> {\n source = <span class=\"hljs-string\">\"git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.0.40\"</span>\n\n # (<span class=\"hljs-built_in\">..</span>. options omitted<span class=\"hljs-built_in\">..</span>.)\n}\n<span class=\"hljs-built_in\">\nresource </span><span class=\"hljs-string\">\"aws_iam_policy\"</span> <span class=\"hljs-string\">\"my_custom_policy\"</span> {\n name = <span class=\"hljs-string\">\"my-custom-policy\"</span>\n <span class=\"hljs-built_in\"> policy </span>= <span class=\"hljs-string\">\" (... omitted ...) \"</span>\n}\n<span class=\"hljs-built_in\">\nresource </span><span class=\"hljs-string\">\"aws_iam_policy_attachment\"</span> <span class=\"hljs-string\">\"attachment\"</span> {\n name = <span class=\"hljs-string\">\"example-attachment\"</span>\n roles = [<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${module.jenkins.iam_role_id}</span>\"</span>]\n policy_arn = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${aws_iam_policy.my_custom_policy.arn}</span>\"</span>\n}\n</pre>\n","repoName":"module-server","repoRef":"v0.15.16","serviceDescriptor":{"serviceName":"Single EC2 Instance","serviceRepoName":"module-server","serviceRepoOrg":"gruntwork-io","cloudProviders":["aws"],"description":"Run a single EC2 instance for stateless or stateful apps. Supports IAM roles, EBS volumes, ENIs, and EIPs.","imageUrl":"single-service.png","licenseType":"subscriber","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"Server orchestration","fileName":"README.md","filePath":"/modules/single-server","title":"Repo Browser: Single EC2 Instance","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}