{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/4826","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/4826/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/4826/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/4826/events","html_url":"https://github.com/hashicorp/terraform/pull/4826","id":128607785,"number":4826,"title":"provider/aws: Add aws_lambda_permission","user":{"login":"radeksimko","id":287584,"avatar_url":"https://avatars.githubusercontent.com/u/287584?v=3","gravatar_id":"","url":"https://api.github.com/users/radeksimko","html_url":"https://github.com/radeksimko","followers_url":"https://api.github.com/users/radeksimko/followers","following_url":"https://api.github.com/users/radeksimko/following{/other_user}","gists_url":"https://api.github.com/users/radeksimko/gists{/gist_id}","starred_url":"https://api.github.com/users/radeksimko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radeksimko/subscriptions","organizations_url":"https://api.github.com/users/radeksimko/orgs","repos_url":"https://api.github.com/users/radeksimko/repos","events_url":"https://api.github.com/users/radeksimko/events{/privacy}","received_events_url":"https://api.github.com/users/radeksimko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/enhancement","name":"enhancement","color":"d4c5f9"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/provider/aws","name":"provider/aws","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-25T18:40:27Z","updated_at":"2016-02-14T18:44:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/4826","html_url":"https://github.com/hashicorp/terraform/pull/4826","diff_url":"https://github.com/hashicorp/terraform/pull/4826.diff","patch_url":"https://github.com/hashicorp/terraform/pull/4826.patch"},"body":"This should allow users to schedule Lambda functions via CloudWatch events (essentially crontab functionality) and/or connect functions to other AWS products, like SNS, S3 etc.\r\n\r\nIt is closing https://github.com/hashicorp/terraform/issues/2885 & https://github.com/hashicorp/terraform/issues/4454\r\n\r\nTODO list follows:\r\n\r\n - [x] Implement basic CRD functionality\r\n - [x] Document new resource\r\n - [x] Work around `ResourceConflictException` (retry) - similar problem to https://github.com/hashicorp/terraform/pull/4825\r\n - [x] Tests for all validators\r\n - [x] Acceptance test for minimal config\r\n - [x] Acceptance test for full config (including `qualifier`)\r\n - [x] Acceptance test with multiple permissions\r\n - [x] Acceptance test with `function_name` as `myFunction` (as opposed to ARN)\r\n - [x] Acceptance test with SNS\r\n - [x] Acceptance test with S3\r\n - [x] Acceptance test for `ResourceConflictException`\r\n - [x] Document example with SNS\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/183948694","html_url":"https://github.com/hashicorp/terraform/pull/4826#issuecomment-183948694","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/4826","id":183948694,"user":{"login":"radeksimko","id":287584,"avatar_url":"https://avatars.githubusercontent.com/u/287584?v=3","gravatar_id":"","url":"https://api.github.com/users/radeksimko","html_url":"https://github.com/radeksimko","followers_url":"https://api.github.com/users/radeksimko/followers","following_url":"https://api.github.com/users/radeksimko/following{/other_user}","gists_url":"https://api.github.com/users/radeksimko/gists{/gist_id}","starred_url":"https://api.github.com/users/radeksimko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radeksimko/subscriptions","organizations_url":"https://api.github.com/users/radeksimko/orgs","repos_url":"https://api.github.com/users/radeksimko/repos","events_url":"https://api.github.com/users/radeksimko/events{/privacy}","received_events_url":"https://api.github.com/users/radeksimko/received_events","type":"User","site_admin":false},"created_at":"2016-02-14T18:44:12Z","updated_at":"2016-02-14T18:44:12Z","body":"I will need to work around the intermittent issues with permissions being lost.\r\n\r\nHere's the full explanation including isolated reproduction case sent as support ticket to AWS:\r\nhttps://gist.github.com/radeksimko/07e5f8ea3e873143666e\r\n\r\nI reckon they will say it's the nature of the API (inconsistent in the same way as IAM). The solution I plan to implement includes mutex to prevent creating more permissions for the same function at the same time. It inherently makes creation of multiple resources of this type less efficient (slower), but there doesn't seem to be any other way around it.\r\n\r\nWe already use mutex in AWS provider, as @stack72 mentioned - in `aws_security_group_rule`."}}