Update TF branch to latest (#5525)
This commit is contained in:
parent
8af786ed25
commit
8486646f2d
4
.github/workflows/test_terraform.yml
vendored
4
.github/workflows/test_terraform.yml
vendored
@ -47,9 +47,9 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ matrix.service }}-${{ hashFiles('**/tests/terraformtests/terraform-provider-aws/go.sum') }}
|
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/tests/terraformtests/terraform-provider-aws/go.sum') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-go-${{ matrix.go-version }}-${{ matrix.service }}-
|
${{ runner.os }}-go-${{ matrix.go-version }}-
|
||||||
- name: Get list of tests for this service
|
- name: Get list of tests for this service
|
||||||
id: get-list
|
id: get-list
|
||||||
run: echo "::set-output name=testlist::$(python tests/terraformtests/get_tf_tests.py '${{ matrix.service }}')"
|
run: echo "::set-output name=testlist::$(python tests/terraformtests/get_tf_tests.py '${{ matrix.service }}')"
|
||||||
|
@ -137,6 +137,10 @@ class AutoScalingResponse(BaseResponse):
|
|||||||
template = self.response_template(DELETE_SCHEDULED_ACTION_TEMPLATE)
|
template = self.response_template(DELETE_SCHEDULED_ACTION_TEMPLATE)
|
||||||
return template.render()
|
return template.render()
|
||||||
|
|
||||||
|
def describe_scaling_activities(self):
|
||||||
|
template = self.response_template(DESCRIBE_SCALING_ACTIVITIES_TEMPLATE)
|
||||||
|
return template.render()
|
||||||
|
|
||||||
@amz_crc32
|
@amz_crc32
|
||||||
@amzn_request_id
|
@amzn_request_id
|
||||||
def attach_instances(self):
|
def attach_instances(self):
|
||||||
@ -883,6 +887,14 @@ DELETE_AUTOSCALING_GROUP_TEMPLATE = """<DeleteAutoScalingGroupResponse xmlns="ht
|
|||||||
</ResponseMetadata>
|
</ResponseMetadata>
|
||||||
</DeleteAutoScalingGroupResponse>"""
|
</DeleteAutoScalingGroupResponse>"""
|
||||||
|
|
||||||
|
DESCRIBE_SCALING_ACTIVITIES_TEMPLATE = """<DescribeScalingActivitiesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
|
||||||
|
<DescribeScalingActivitiesResult>
|
||||||
|
</DescribeScalingActivitiesResult>
|
||||||
|
<ResponseMetadata>
|
||||||
|
<RequestId></RequestId>
|
||||||
|
</ResponseMetadata>
|
||||||
|
</DescribeScalingActivitiesResponse>"""
|
||||||
|
|
||||||
DESCRIBE_AUTOSCALING_INSTANCES_TEMPLATE = """<DescribeAutoScalingInstancesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
|
DESCRIBE_AUTOSCALING_INSTANCES_TEMPLATE = """<DescribeAutoScalingInstancesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
|
||||||
<DescribeAutoScalingInstancesResult>
|
<DescribeAutoScalingInstancesResult>
|
||||||
<AutoScalingInstances>
|
<AutoScalingInstances>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
from .exceptions import CostCategoryNotFound
|
from .exceptions import CostCategoryNotFound
|
||||||
from moto.core import BaseBackend, BaseModel
|
from moto.core import BaseBackend, BaseModel
|
||||||
from moto.core.utils import BackendDict
|
from moto.core.utils import BackendDict
|
||||||
|
from moto.utilities.tagging_service import TaggingService
|
||||||
from moto.moto_api._internal import mock_random
|
from moto.moto_api._internal import mock_random
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ class CostExplorerBackend(BaseBackend):
|
|||||||
def __init__(self, region_name, account_id):
|
def __init__(self, region_name, account_id):
|
||||||
super().__init__(region_name, account_id)
|
super().__init__(region_name, account_id)
|
||||||
self.cost_categories = dict()
|
self.cost_categories = dict()
|
||||||
|
self.tagger = TaggingService()
|
||||||
|
|
||||||
def create_cost_category_definition(
|
def create_cost_category_definition(
|
||||||
self,
|
self,
|
||||||
@ -48,6 +50,7 @@ class CostExplorerBackend(BaseBackend):
|
|||||||
rules,
|
rules,
|
||||||
default_value,
|
default_value,
|
||||||
split_charge_rules,
|
split_charge_rules,
|
||||||
|
tags,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
The EffectiveOn and ResourceTags-parameters are not yet implemented
|
The EffectiveOn and ResourceTags-parameters are not yet implemented
|
||||||
@ -61,6 +64,7 @@ class CostExplorerBackend(BaseBackend):
|
|||||||
split_charge_rules,
|
split_charge_rules,
|
||||||
)
|
)
|
||||||
self.cost_categories[ccd.arn] = ccd
|
self.cost_categories[ccd.arn] = ccd
|
||||||
|
self.tag_resource(ccd.arn, tags)
|
||||||
return ccd.arn, ""
|
return ccd.arn, ""
|
||||||
|
|
||||||
def describe_cost_category_definition(self, cost_category_arn):
|
def describe_cost_category_definition(self, cost_category_arn):
|
||||||
@ -90,6 +94,15 @@ class CostExplorerBackend(BaseBackend):
|
|||||||
|
|
||||||
return cost_category_arn, ""
|
return cost_category_arn, ""
|
||||||
|
|
||||||
|
def list_tags_for_resource(self, resource_arn):
|
||||||
|
return self.tagger.list_tags_for_resource(arn=resource_arn)["Tags"]
|
||||||
|
|
||||||
|
def tag_resource(self, resource_arn, tags):
|
||||||
|
self.tagger.tag_resource(resource_arn, tags)
|
||||||
|
|
||||||
|
def untag_resource(self, resource_arn, tag_keys):
|
||||||
|
self.tagger.untag_resource_using_names(resource_arn, tag_keys)
|
||||||
|
|
||||||
|
|
||||||
ce_backends = BackendDict(
|
ce_backends = BackendDict(
|
||||||
CostExplorerBackend, "ce", use_boto3_regions=False, additional_regions=["global"]
|
CostExplorerBackend, "ce", use_boto3_regions=False, additional_regions=["global"]
|
||||||
|
@ -20,6 +20,7 @@ class CostExplorerResponse(BaseResponse):
|
|||||||
rules = params.get("Rules")
|
rules = params.get("Rules")
|
||||||
default_value = params.get("DefaultValue")
|
default_value = params.get("DefaultValue")
|
||||||
split_charge_rules = params.get("SplitChargeRules")
|
split_charge_rules = params.get("SplitChargeRules")
|
||||||
|
tags = params.get("ResourceTags")
|
||||||
(
|
(
|
||||||
cost_category_arn,
|
cost_category_arn,
|
||||||
effective_start,
|
effective_start,
|
||||||
@ -29,6 +30,7 @@ class CostExplorerResponse(BaseResponse):
|
|||||||
rules=rules,
|
rules=rules,
|
||||||
default_value=default_value,
|
default_value=default_value,
|
||||||
split_charge_rules=split_charge_rules,
|
split_charge_rules=split_charge_rules,
|
||||||
|
tags=tags,
|
||||||
)
|
)
|
||||||
return json.dumps(
|
return json.dumps(
|
||||||
dict(CostCategoryArn=cost_category_arn, EffectiveStart=effective_start)
|
dict(CostCategoryArn=cost_category_arn, EffectiveStart=effective_start)
|
||||||
@ -75,3 +77,23 @@ class CostExplorerResponse(BaseResponse):
|
|||||||
return json.dumps(
|
return json.dumps(
|
||||||
dict(CostCategoryArn=cost_category_arn, EffectiveStart=effective_start)
|
dict(CostCategoryArn=cost_category_arn, EffectiveStart=effective_start)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def list_tags_for_resource(self):
|
||||||
|
params = json.loads(self.body)
|
||||||
|
resource_arn = params.get("ResourceArn")
|
||||||
|
tags = self.ce_backend.list_tags_for_resource(resource_arn)
|
||||||
|
return json.dumps({"ResourceTags": tags})
|
||||||
|
|
||||||
|
def tag_resource(self):
|
||||||
|
params = json.loads(self.body)
|
||||||
|
resource_arn = params.get("ResourceArn")
|
||||||
|
tags = params.get("ResourceTags")
|
||||||
|
self.ce_backend.tag_resource(resource_arn, tags)
|
||||||
|
return json.dumps({})
|
||||||
|
|
||||||
|
def untag_resource(self):
|
||||||
|
params = json.loads(self.body)
|
||||||
|
resource_arn = params.get("ResourceArn")
|
||||||
|
tag_names = params.get("ResourceTagKeys")
|
||||||
|
self.ce_backend.untag_resource(resource_arn, tag_names)
|
||||||
|
return json.dumps({})
|
||||||
|
@ -525,6 +525,7 @@ class FakeLoadBalancer(CloudFormationModel):
|
|||||||
"load_balancing.cross_zone.enabled",
|
"load_balancing.cross_zone.enabled",
|
||||||
"routing.http.desync_mitigation_mode",
|
"routing.http.desync_mitigation_mode",
|
||||||
"routing.http.drop_invalid_header_fields.enabled",
|
"routing.http.drop_invalid_header_fields.enabled",
|
||||||
|
"routing.http.preserve_host_header.enabled",
|
||||||
"routing.http.x_amzn_tls_version_and_cipher_suite.enabled",
|
"routing.http.x_amzn_tls_version_and_cipher_suite.enabled",
|
||||||
"routing.http.xff_client_port.enabled",
|
"routing.http.xff_client_port.enabled",
|
||||||
"routing.http2.enabled",
|
"routing.http2.enabled",
|
||||||
|
@ -1,18 +1,8 @@
|
|||||||
From 91f2d9c33f241cb9dfb3700eaa739a46a06a29bc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Bert Blommers <info@bertblommers.nl>
|
|
||||||
Date: Wed, 29 Jun 2022 16:24:04 +0000
|
|
||||||
Subject: [PATCH] Patch: Hardcode endpoints
|
|
||||||
|
|
||||||
---
|
|
||||||
internal/conns/config.go | 15 +++++++++++++++
|
|
||||||
internal/provider/provider.go | 4 ++--
|
|
||||||
2 files changed, 17 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/internal/conns/config.go b/internal/conns/config.go
|
diff --git a/internal/conns/config.go b/internal/conns/config.go
|
||||||
index 7bfd3100fd..b59083068a 100644
|
index 13b7d153a7..1d981e9097 100644
|
||||||
--- a/internal/conns/config.go
|
--- a/internal/conns/config.go
|
||||||
+++ b/internal/conns/config.go
|
+++ b/internal/conns/config.go
|
||||||
@@ -78,8 +78,23 @@ type Config struct {
|
@@ -86,8 +86,23 @@ type Config struct {
|
||||||
UseFIPSEndpoint bool
|
UseFIPSEndpoint bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,8 +16,8 @@ index 7bfd3100fd..b59083068a 100644
|
|||||||
+ return localEndpoints
|
+ return localEndpoints
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
// Client configures and returns a fully initialized AWSClient
|
// ConfigureProvider configures the provided provider Meta (instance data).
|
||||||
func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
|
func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWSClient, diag.Diagnostics) {
|
||||||
+
|
+
|
||||||
+ // XXX: added by bblommers
|
+ // XXX: added by bblommers
|
||||||
+ // insert custom endpoints
|
+ // insert custom endpoints
|
||||||
@ -37,19 +27,18 @@ index 7bfd3100fd..b59083068a 100644
|
|||||||
AccessKey: c.AccessKey,
|
AccessKey: c.AccessKey,
|
||||||
APNInfo: StdUserAgentProducts(c.TerraformVersion),
|
APNInfo: StdUserAgentProducts(c.TerraformVersion),
|
||||||
diff --git a/internal/provider/provider.go b/internal/provider/provider.go
|
diff --git a/internal/provider/provider.go b/internal/provider/provider.go
|
||||||
index 7e6200d9ac..98d8c4fccc 100644
|
index c49bd366d3..2db930e61d 100644
|
||||||
--- a/internal/provider/provider.go
|
--- a/internal/provider/provider.go
|
||||||
+++ b/internal/provider/provider.go
|
+++ b/internal/provider/provider.go
|
||||||
@@ -2082,14 +2082,14 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
|
@@ -2196,13 +2196,13 @@ func configure(ctx context.Context, provider *schema.Provider, d *schema.Resourc
|
||||||
CustomCABundle: d.Get("custom_ca_bundle").(string),
|
CustomCABundle: d.Get("custom_ca_bundle").(string),
|
||||||
EC2MetadataServiceEndpoint: d.Get("ec2_metadata_service_endpoint").(string),
|
EC2MetadataServiceEndpoint: d.Get("ec2_metadata_service_endpoint").(string),
|
||||||
EC2MetadataServiceEndpointMode: d.Get("ec2_metadata_service_endpoint_mode").(string),
|
EC2MetadataServiceEndpointMode: d.Get("ec2_metadata_service_endpoint_mode").(string),
|
||||||
- Endpoints: make(map[string]string),
|
- Endpoints: make(map[string]string),
|
||||||
+ Endpoints: conns.GetLocalEndpoints(), // XXX: added by bblommers
|
+ Endpoints: conns.GetLocalEndpoints(), // XXX: added by bblommers
|
||||||
HTTPProxy: d.Get("http_proxy").(string),
|
HTTPProxy: d.Get("http_proxy").(string),
|
||||||
IgnoreTagsConfig: expandProviderIgnoreTags(d.Get("ignore_tags").([]interface{})),
|
|
||||||
Insecure: d.Get("insecure").(bool),
|
Insecure: d.Get("insecure").(bool),
|
||||||
MaxRetries: d.Get("max_retries").(int),
|
MaxRetries: 25, // Set default here, not in schema (muxing with v6 provider).
|
||||||
Profile: d.Get("profile").(string),
|
Profile: d.Get("profile").(string),
|
||||||
Region: d.Get("region").(string),
|
Region: d.Get("region").(string),
|
||||||
- S3UsePathStyle: d.Get("s3_use_path_style").(bool) || d.Get("s3_force_path_style").(bool),
|
- S3UsePathStyle: d.Get("s3_use_path_style").(bool) || d.Get("s3_force_path_style").(bool),
|
||||||
@ -57,6 +46,3 @@ index 7e6200d9ac..98d8c4fccc 100644
|
|||||||
SecretKey: d.Get("secret_key").(string),
|
SecretKey: d.Get("secret_key").(string),
|
||||||
SkipCredsValidation: d.Get("skip_credentials_validation").(bool),
|
SkipCredsValidation: d.Get("skip_credentials_validation").(bool),
|
||||||
SkipGetEC2Platforms: d.Get("skip_get_ec2_platforms").(bool),
|
SkipGetEC2Platforms: d.Get("skip_get_ec2_platforms").(bool),
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 3c1f58b59a45aaecc9a4b243d5b1004283b3353b
|
Subproject commit 6020c871a99278bc855638a801e662328ab2b342
|
@ -177,7 +177,12 @@ kms:
|
|||||||
- TestAccKMSSecretsDataSource
|
- TestAccKMSSecretsDataSource
|
||||||
lambda:
|
lambda:
|
||||||
- TestAccLambdaAlias_
|
- TestAccLambdaAlias_
|
||||||
- TestAccLambdaLayerVersion_
|
- TestAccLambdaLayerVersion_basic
|
||||||
|
- TestAccLambdaLayerVersion_compatibleArchitectures
|
||||||
|
- TestAccLambdaLayerVersion_compatibleRuntimes
|
||||||
|
- TestAccLambdaLayerVersion_licenseInfo
|
||||||
|
- TestAccLambdaLayerVersion_s3
|
||||||
|
- TestAccLambdaLayerVersion_update
|
||||||
- TestAccLambdaFunctionURL
|
- TestAccLambdaFunctionURL
|
||||||
meta:
|
meta:
|
||||||
- TestAccMetaBillingServiceAccountDataSource
|
- TestAccMetaBillingServiceAccountDataSource
|
||||||
|
55
tests/test_ce/test_ce_tags.py
Normal file
55
tests/test_ce/test_ce_tags.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import boto3
|
||||||
|
import sure # noqa # pylint: disable=unused-import
|
||||||
|
|
||||||
|
from moto import mock_ce
|
||||||
|
|
||||||
|
# See our Development Tips on writing tests for hints on how to write good tests:
|
||||||
|
# http://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.html
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ce
|
||||||
|
def test_list_tags_if_none_exist():
|
||||||
|
client = boto3.client("ce", region_name="ap-southeast-1")
|
||||||
|
arn = client.create_cost_category_definition(
|
||||||
|
Name="ccd",
|
||||||
|
RuleVersion="CostCategoryExpression.v1",
|
||||||
|
Rules=[
|
||||||
|
{"Value": "v", "Rule": {"CostCategories": {"Key": "k", "Values": ["v"]}}}
|
||||||
|
],
|
||||||
|
)["CostCategoryArn"]
|
||||||
|
|
||||||
|
resp = client.list_tags_for_resource(ResourceArn=arn)
|
||||||
|
resp.should.have.key("ResourceTags").equals([])
|
||||||
|
|
||||||
|
client.tag_resource(ResourceArn=arn, ResourceTags=[{"Key": "t1", "Value": "v1"}])
|
||||||
|
|
||||||
|
resp = client.list_tags_for_resource(ResourceArn=arn)
|
||||||
|
resp.should.have.key("ResourceTags").equals([{"Key": "t1", "Value": "v1"}])
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ce
|
||||||
|
def test_cost_category_tags_workflow():
|
||||||
|
client = boto3.client("ce", region_name="ap-southeast-1")
|
||||||
|
arn = client.create_cost_category_definition(
|
||||||
|
Name="ccd",
|
||||||
|
RuleVersion="CostCategoryExpression.v1",
|
||||||
|
Rules=[
|
||||||
|
{"Value": "v", "Rule": {"CostCategories": {"Key": "k", "Values": ["v"]}}}
|
||||||
|
],
|
||||||
|
ResourceTags=[{"Key": "t1", "Value": "v1"}],
|
||||||
|
)["CostCategoryArn"]
|
||||||
|
|
||||||
|
resp = client.list_tags_for_resource(ResourceArn=arn)
|
||||||
|
resp.should.have.key("ResourceTags").equals([{"Key": "t1", "Value": "v1"}])
|
||||||
|
|
||||||
|
client.tag_resource(ResourceArn=arn, ResourceTags=[{"Key": "t2", "Value": "v2"}])
|
||||||
|
|
||||||
|
resp = client.list_tags_for_resource(ResourceArn=arn)
|
||||||
|
resp.should.have.key("ResourceTags").equals(
|
||||||
|
[{"Key": "t1", "Value": "v1"}, {"Key": "t2", "Value": "v2"}]
|
||||||
|
)
|
||||||
|
|
||||||
|
client.untag_resource(ResourceArn=arn, ResourceTagKeys=["t2"])
|
||||||
|
|
||||||
|
resp = client.list_tags_for_resource(ResourceArn=arn)
|
||||||
|
resp.should.have.key("ResourceTags").equals([{"Key": "t1", "Value": "v1"}])
|
Loading…
Reference in New Issue
Block a user